Thursday 20 April 2017

how to debug powershell script

Windows PowerShell ISE:
Windows Powershell ISE tool  come along with the installation of windows server 2012.

Once you click on the Windows Powershell ISE  App, It will open the below screen. Where you can create a new script file by choosing file icon.
I am using the once of scripts which you have seen in this blog for the demo.
To debug the script select the line of code where you want to place the breakpoint and then go to "Debug" menu option and click on "Toggle BreakPoint" or F9. This will add the breakpoint.


When you execute the script by pressing F5 keyword, once it hits the breakpoint you can debug the scripts. See the below screenshot where we are finding the value of "$webapp" which webapplication value.


  

No comments:

Post a Comment