How to debug Powershell commandlets?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Alexander Vasilevsky

    #1

    How to debug Powershell commandlets?

    Hi!

    How to debug Powershell commandlets?

    --
    http://www.alvas.net - Audio tools for C# and VB.Net developers




  • John Vottero

    #2
    Re: How to debug Powershell commandlets?

    "Alexander Vasilevsky" <alvas@alvas.ne twrote in message
    news:fgk54e$l1v $1@behemoth.vol ia.net...
    Hi!
    >
    How to debug Powershell commandlets?
    >
    First, you have to register the debug version of your snap-in. You must be
    an administrator to do that but, you only have to do that once (and when
    your version changes). I always register my snap-ins twice, once with
    "Debug." prepended to the name and once without. Obviously, the "debug"
    points to the dll in my development debug directory.

    Once you have that set, go into the project's "Properties ", pick the "Debug"
    tab and change the Start Action to "Start External Program" and locate
    PowerShell.exe as the external program. Then, in the "Start Options",
    "Command line arguments", enter:

    -NoExit -Command Add-PSSnapin Debug.YourSnapi n

    (Assuming that your snapin is registered as "Debug.Yoursnap in")

    After that, you just hit F5 and you get a powershell prompt with your snapin
    enabled, enter whatever command you want to debug. You can set breakpoints
    etc, etc.


    Comment

    Working...