Debugging scripts

How do I get PowerShell to spit out what happens in each line of a script without having to type each variable every line?

IMO It’s relatively simple in ISE.


ISESteroids has a “Variable Monitor” feature that sounds like what you’re looking for. The module isn’t free, but I’ve been very happy with the investment since I write PowerShell code for a living. It has a huge set of features to turn the ISE into a much more professional development environment.

Thanks guys. GJ I’ve seen all the links before but somehow I missed the functionality of ISE where it shows you the value when you hover your mouse over a variable. I’m just a beginner so ISESteroides would probably be an overkill at this stage but thanks for mentioning it.

I dunno, I think 'Steroids would make being a beginner somewhat easier.

Just add Write-Debug “$variablename” to each relevant part of your script and run the script with the -Debug switch. You’ll get debug output for each phase!