In this PowerShell tutorial, we will discuss Windows PowerShell ISE. We will discuss below things:
- What is Windows PowerShell ISE?
- How to start ISE?
- How to find the Current Version of PowerShell using it?
- How to create a script in Windows PowerShell ISE?
- How to debug PowerShell script?
- Advantages of using it?
Windows PowerShell ISE Video Tutorial
Subscribe to EnjoySharePoint YouTube Channel for more free videos.
What is Windows PowerShell ISE
Now, we will discuss what it is and what are the advantages of PowerShell ISE.
What is PowerShell?
Windows PowerShell is a shell (the shell is a user interface that gives you access to various services of an operating system) developed by Microsoft for purposes of task automation and configuration management. This powerful shell is based on the .NET framework and it includes a command-line shell and a scripting language.
What is Windows PowerShell ISE?
It is a scripting environment where you can run commands and write, test, and debug scripts in a single Windows-based graphic user interface with multiline editing, tab completion, syntax coloring, selective execution, context-sensitive help, and support for right-to-left languages.
It stands for PowerShell Integrated Scripting Environment.
Windows PowerShell ISE download
You can download Module Browser for Windows PowerShell ISE from this URL.
How to start with It?
In any of the operating systems (Windows7,8 or 10 or any server operating system like windows server 2012 or windows server 2012 r2) search for “Windows PowerShell ISE”, then it will display like below:
Apart from the above method, you can also run it from Run box. Click on Windows+R to open the Run box and then type powershell_ise.exe and click on Enter. This will also open the PowerShell ISE.
How to find Current Version of PowerShell?
We can easily get the current version of PowerShell installed in the machine by executing the below command in the command window.
Once you run the above command it will display various details like PSVersion, BuildVersion, PSCompatiableVersion, CLRVersion etc. like below:
How to create a script using ISE?
We can easily create a script by clicking on the new button below toolbar and then you can write the PowerShell script. Similarly, you can easily Save Open existing PowerShell script by clicking on Open Folder and Save button.
How to debug in PowerShell ISE?
One of the biggest advantages of using it is that we can easily debug PowerShell script.
Note: Before start debugging, we need to first Save the script.
Once you save the script, Right-click on the line where you want to put the debugger and click on “Toggle Brealpoint” like below:
Or you can also put the cursor on the line where you want to attach the debugger and then press F9. The debugger will appear like below:
Then you can click on “run script” icon in the toolbar or you can also press F5 which will start the debugging
Once it reaches the debugger point it will stay in that line. Then you can use F10 to debug line by line and also you can use F11 for step over. You can press “Shift + F5” to stop debugging. The debugging shortcuts same like any other Microsoft IDE.
It will also show a message in the console once it Hit breakpoint like below:
Advantages of PowerShell ISE
Now, we will see few advantages of using it.
PowerShell ISE supports IntelliSense. When you type cmdlets it will display possible values for the cmdlets. For example, if I am writing Write- it is showing me the values in IntelliSense Debug, error, Host etc like below:
Similarly, if I will write “-” after cmdlets, it will display the parameters. This will be very much helpful if you are not sure about the parameters for the cmdlets. Here I have written one Get-Date and then
If you are working with a large script like “Upload large files to SharePoint online document library using PowerShell csom”, you may need to run and see a portion of the script. It provides “Run Selection” option by which you can run a portion from the script.
Select the portion which you want to run and then click on “Run Selection” button from the toolbar. Alternatively, you can click on F8, only the selected portion will run.
Easily Copy, Paste and Clear
It is really difficult to copy or paste in a PowerShell command prompt but it is very easy in PowerShell ISE. You can do copy & paste by using Ctrl + C and Ctrl + V.
Also, you can clear the console by clicking on “Clear Console Pane” button from toolbar like below:
Debug Script using PowerShell ISE
As discussed in the above steps, you can easily debug a script using PowerShell ISE.
One-Click Open PowerShell Command Prompt
From Windows PowerShell ISE, you can open the command prompt by clicking on the “Start PowerShell.exe” button from toolbar like below:
By using Command Add-on, you can search PowerShell cmdlets. Once you click on “Show Command Add-on” button it will open the Commands on the right side. You can search for cmdlets there.
Open Multiple Scripts in Tabs
In PowerShell ISE, you can open multiple scripts in multiple tabs. You can also debug script in each tab separately.
PowerShell cannot be loaded because running scripts is disabled on this system windows 10
Let us see, how to solve PowerShell cannot be loaded because the execution of scripts is disabled issue, which comes while running PowerShell cmdlets in Windows 10 machine.
Recently I was trying to run a PowerShell command using PowerShell ISE, but it gave an error:
cannot be loaded because running scripts is disabled on this system like below:
PowerShell cannot be loaded because the execution of scripts is disabled
The error was coming because the PowerShell execution policy doesn’t allow to run scripts by default in the Windows 10 laptop.
By default, the PowerShell policy was set to Restricted which means No scripts can be executed.
To allow script execution, we need to use the Set-ExecutionPolicy PowerShell cmdlets. Run the cmdlet like below:
It will show you a confirmation box, select Yes to All, and then when you run any cmdlets in PowerShell, it will run successfully like below:
To run outside script set Set-ExecutionPolicy to RemoteSigned like:
Below are the different types of policies we can set for PowerShell.
- Restricted: You can run any script, no script is allowed to run.
- Unrestricted: All Windows PowerShell scripts can be run.
- AllSigned: Only trusted publisher scripts are allowed to run.
- RemoteSigned: Downloaded scripts must be signed by a trusted publisher.
If you want to know what is current policy set, then you can run the below PowerShell cmdlets.
You can bypass this policy by adding -ExecutionPolicy ByPass when running PowerShell
powershell -ExecutionPolicy ByPass -File myscript.ps1
If you wanted to change the policy to RemoteSigned/Unrestricted for just the CurrentUser, you can run the below PowerShell cmdlets.
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser or Set-ExecutionPolicy -Scope "CurrentUser" -ExecutionPolicy "Unrestricted" or Set-ExecutionPolicy -Scope "CurrentUser" -ExecutionPolicy "RemoteSigned"
This is how to solve cannot be loaded because running scripts is disabled on this system error which comes in windows 10 while running PowerShell cmdlets.
Read some PowerShell tutorials:
- Missing argument in parameter list PowerShell
- Get SharePoint document library size using PowerShell
- PowerShell SharePoint Online: The remote server returned an error: (403) Forbidden
- PowerShell reference variable
- Working with PowerShell Date Command (Get-Date)
- Retrieve all list names and list guids from SharePoint online site using PowerShell
- What is a PowerShell variable
- SharePoint 2016 PowerShell Script to list all Users in Site Collection
- SharePoint 2013 backup and restore using PowerShell
I hope this tutorial, we learned Windows PowerShell ISE, advantages of PowerShell ISE and how to debug script using it.
I am Bijay a Microsoft MVP (10 times – My MVP Profile) in SharePoint and have more than 17 years of expertise in SharePoint Online Office 365, SharePoint subscription edition, and SharePoint 2019/2016/2013. Currently working in my own venture TSInfo Technologies a SharePoint development, consulting, and training company. I also run the popular SharePoint website EnjoySharePoint.com