Windows PowerShell ISE Tutorial

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:

Windows PowerShell ISE Download
Windows PowerShell ISE Download

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.

$PSVersionTable

Once you run the above command it will display various details like PSVersion, BuildVersion, PSCompatiableVersion, CLRVersion etc. like below:

powershell ise
Find current version of Windows PowerShell

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.

Create PowerShell script using Windows PowerShell ISE
Create PowerShell script using Windows PowerShell ISE

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:

Debug PowerShell Script
Debug PowerShell Script

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:

powershell ise
Debug PowerShell Script using PowerShell ISE Steps

Then you can click on “run script” icon in the toolbar or you can also press F5 which will start the debugging

How to debug PowerShell Script using PowerShell ISE?
How to debug PowerShell Script using PowerShell ISE?

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:

Steps to debug PowerShell Script using PowerShell ISE
Steps to debug PowerShell Script using PowerShell ISE

Advantages of PowerShell ISE

Now, we will see few advantages of using it.

IntelliSense

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:

Advantages of PowerShell ISE IntelliSense
Advantages of PowerShell ISE IntelliSense

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

Advantages of Windows PowerShell ISE
Advantages of Windows PowerShell ISE

Run Selection

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.

Advantages of PowerShell ISE Run Selection
Advantages of PowerShell ISE Run Selection

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:

Advantages of PowerShell ISE Clear Console
Advantages of PowerShell ISE Clear Console

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:

Advantages of PowerShell ISE PowerShell Command Prompt
Advantages of PowerShell ISE PowerShell Command Prompt

Command Add-on

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.

Advantages of PowerShell ISE Command Add-on
Advantages of PowerShell ISE Command Add-on

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.

Advantages of PowerShell ISE open multiple scripts in tabs
Advantages of PowerShell ISE open multiple scripts in tabs

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
PowerShell cannot be loaded

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:

Set-ExecutionPolicy Unrestricted

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:

powershell cannot be loaded because running scripts is disabled on this system

To run outside script set Set-ExecutionPolicy to RemoteSigned like:

Set-ExecutionPolicy RemoteSigned 

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.

get-executionpolicy

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:

I hope this tutorial, we learned Windows PowerShell ISE, advantages of PowerShell ISE and how to debug script using it.

  • >