In this article you will learn how to debug powershell scripts using Windows powershell ISE.
For a developer or an administrator debugging the scripts is one of the common tasks. So the tool that helps to debug is..
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.
And for those of you looking for more advanced tips and tricks for Powershell, make sure to check out Powershell courses here by Vlad which improved my skills. By the way, this link is an affiliated link, which means that I earn a commission if you do end up joining PluralSight. It's at no extra cost to you, and please if you have any questions related to this product, please let me know, i would be happy to answer them for you.
In this article you have seen how to debug the powershell scripts using Windows powershell ISE.
Devendra Velegandla is a five-time recipient of Microsoft's Most Valuable Professional (MVP) award (2014-2019) for Office Apps and Services, Office Servers and Services MVP and SharePoint Server. He received the MCC award for his contributions in Microsoft MSDN/TechNet forums. He loves sharing articles, videos, and tutorial on SharePoint and Office 365.