Use the PowerShell ISE to Work with Long Commands

Doctor Scripto

Summary: Learn how to use the Windows PowerShell ISE to work with long commands and make things easier to understand.

Hey, Scripting Guy! Question Hey, Scripting Guy! I don’t get the purpose of the Windows PowerShell ISE. I mean, we have the Windows PowerShell console, and most of the time, all I am doing is typing a few commands there. Why should I use the Windows PowerShell ISE when it takes at least three times as long to load on my computer as the Windows PowerShell console does?


Hey, Scripting Guy! AnswerHello PG,

Microsoft Scripting Guy, Ed Wilson, is here. Wow, it is a little more than a month until the Central Ohio PowerShell Users group hosts the first ever PowerShell Saturday event. The Scripting Wife and I are looking forward to this event. (In fact, the Scripting Wife did a lot of the organization for the event along with Wes Stahler, Ashley McGlone, and Brian Jackett.) This event will be awesome and several Windows PowerShell people are coming in from adjoining states to take part in this exclusive event. I will be presenting a day-long track that covers beginning with Windows PowerShell, and one of the things that I will talk about is the Windows PowerShell ISE.

PG, one of the things you might want to do is to read the Scripting Wife blog, The Scripting Wife Uses the Windows PowerShell ISE. It provides a fun background for my answer today.

I placed the Windows PowerShell ISE on my task bar, right next to the Windows PowerShell console; this makes it easy to use and to get to. If you do not want to do that, it is always possible to launch the Windows PowerShell ISE from inside the Windows PowerShell console by typing the command ise. This command, ise, is technically an alias. The executable name is powershell_ise.exe. The ise alias is resolved by using the Get-Alias cmdlet, as shown here.

PS C:\> Get-Alias ise | fl *

HelpUri             :

ResolvedCommandName : powershell_ise.exe

ReferencedCommand   : powershell_ise.exe

ResolvedCommand     : powershell_ise.exe

Definition          : powershell_ise.exe

Options             : ReadOnly, AllScope

Description         :

OutputType          : {System.String}

Name                : ise

CommandType         : Alias

Visibility          : Public

ModuleName          :

Module              :

Parameters          :

ParameterSets       :

This actually is a cool trick, and it is something that I have not talked about before. Every time I have created an alias, it has been for a Windows PowerShell cmdlet or a Windows PowerShell function. But I can also create an alias for an external executable. For example, I can create an alias called net for the command netsh.exe. Although it is not a huge time savings, it does illustrate the point. The commands shown here create a new alias named net. Use the net alias to enter the net shell, and then use the exit command to leave the net shell and return to the Windows PowerShell prompt.

PS C:\> New-Alias -Name net -Value netsh.exe

PS C:\> net



PS C:\>

The upper pane of Windows PowerShell ISE is the script pane. Just because it is called a script pane does not mean you have to write a script. In fact, I often use it to organize Windows PowerShell commands because it lets me see a better picture of the flow than command continuation characters in the Windows PowerShell prompt. In the image that follows, I type a three-part command that retrieves process information, selects the name and process ID of each process, and displays the output in an automatically sized table.

Image of command output

Four things top keep in mind here are:

  1. Script execution does not have to be enabled. This is because no script is actually being read or executed.
  2. The commands are not saved. When Windows PowerShell is closed, a prompt appears asking if you want to save changes.
  3. When saved, the commands are considered a script; and therefore, the Script Execution policy must be modified to permit the running of scripts.
  4. The Windows PowerShell ISE does not have a transcript tool. Start-Transcript does not work in the Windows PowerShell ISE.

The image that follows illustrates the same three commands and their associated output as it appears in the Windows PowerShell console.

Image of command output

There are also several considerations when running commands in the Windows PowerShell console:

  1. The command editing capabilities in the Windows PowerShell console are not as strong as they are in the Windows PowerShell ISE. For example, there is no undo command.
  2. When the Windows PowerShell console closes, there is no prompt to save the command. All work is lost when the Windows PowerShell console closes.
  3. To record commands and the output from those commands use the Start-Transcript cmdlet.
  4. To create a Windows PowerShell script, redirect the commands to a text file with a .ps1 file extension.

In the Windows PowerShell ISE, when working in the script pane, you can type as many commands as required, and they do not execute until you press the F5 function key (ensure that function lock is not turned on on your keyboard), or you press the large green triangle under the Help menu heading.

One thing that I really like about the Windows PowerShell ISE is the ability to run only a portion of a command in the script pane. The ability to run only a portion of a command is useful not only from a troubleshooting perspective, but it is also useful when running demos whilst making presentations about Windows PowerShell. When highlighted, a selection of the script runs upon pressing the F8 function key or pressing the small green and white icon. This is shown in the image that follows.

Image of command output

PG, that is all there is to getting started with the Windows PowerShell ISE. Windows PowerShell ISE Week will continue tomorrow when I will continue the discussion.

I invite you to follow me on Twitter and Facebook. If you have any questions, send email to me at, or post your questions on the Official Scripting Guys Forum. See you tomorrow. Until then, peace.

Ed Wilson, Microsoft Scripting Guy


Discussion is closed.

Feedback usabilla icon