Developing and Debugging for Windows PowerShell
Here I include a few tips about debugging Windows PowerShell cmdlets and providers. I only do this because I had to "discover" these myself, since the PowerShell documentation only says how to develop extensions from the command line.
I use Visual Studio 2005, create a C# .NET Class Library project, and add a project reference to System.Management.Automation (if you need to browse for the file, it is normally at 'C:\Program Files\Windows PowerShell\v1.0 System.Management.Automation.dll').
The online help at MSDN is kind of broken for PowerShell examples... you have to get the July CTP Windows SDK from
here.
Once you are up and running, you can build your PowerShell SnapIn inside the IDE, then you can register it with PowerShell, then you need to attach the IDE debugger to PowerShell (Debug/Attach to process...), set your break-points at the right places and fire your cmdlet / provider from PowerShell... You can then step through your code in the IDE.