By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,677 Members | 1,217 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,677 IT Pros & Developers. It's quick & easy.

How to debug Powershell commandlets?

P: n/a
Hi!

How to debug Powershell commandlets?

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


Nov 4 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
"Alexander Vasilevsky" <al***@alvas.netwrote in message
news:fg**********@behemoth.volia.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.YourSnapin

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

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.
Nov 4 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.