George Mauer
George Mauer

Reputation: 122182

Can I use powershell to inspect a running .Net process?

Let's say I have a 100% managed .Net application running.

I can attach to it via a visual studio debugger and be able to do things like grab references to a ServiceLocator (if it's static) and so on. I would like to be able to do this in Powershell.

It seems like this should be possible but I have no idea where to start. Any ideas?

Upvotes: 1

Views: 1204

Answers (1)

stej
stej

Reputation: 29479

Have a look at PowerDbg. That's a good start imho.

Short description copied from codeplex:

PowerDbg is a PowerShell library that enables you to easily create PowerShell scripts to automate a WinDbg / CDB debugging session. You can use PowerDbg for Kernel Mode or User Mode, Post-Mortem debugging or Live Debugging and for native or managed code.

PowerShell has several advantages over the WinDbg Scripting Language. A few of them are:

  • Easier to create scripts
  • Leverage the .NET Framework
  • Debugging and tracing features
  • Code reuse through functions and cmdlets
  • Easier maintenance
  • Easier to build large scripts
  • Easier to format and display the important information

Whether you’re an old hand frustrated with WinDbg scripting, or you’re having your ‘first memory dump’ freak-out, PowerDbg is for you. And hopefully for everyone in the middle too.too.

Upvotes: 2

Related Questions