PowerShell 3.0 ISE ponderings

I have played around some with PowerShell and written a few pretty cool scripts to make some administration tasks easier. All of this was done with PowerShell 2.0. I use PowerGui as my editor of choice currently. It provided Intellisense that was not available with PowerShell 2.0 or the ISE.

I attended PowerShell Saturday here in Charlotte, NC on 9/15/2012. Ed Wilson, the current Microsoft Scripting Guy, kicked off the day. And what a day it was. If you have any desire to learn PowerShell, check out his blog as well as the Hey Scripting Guy! articles he publishes daily.

Now all that being said, I have started looking into PowerShell 3.0 which released when Windows Server 2012 did. There is an ISE, Integrated Scripting Environment, that is a host application for Windows PowerShell. This also existed for version 2.0 but has many improvements with the 3.0 release. Version 3 includes Intellisense very similar to what is available in Visual Studio. The ISE incorporates a script window, console and a vertical Add-on Tools pane. You can customize this to include all 3 or any combination.

As PowerShell has evolved, it has become more powerful. For example, version 2 had approximately 200 cmdlets. If there was not an existing cmdlet to achieve what you wanted to do, you could write your own or locate one that someone else had written and shared. Now enter today and PowerShell 3. There are over 2200 cmdlets included with this new release.

When I started using PowerShell, I was happy that they included DOS commands for things like dir and cd. Little did I know, but these are actually aliases that were created within PowerShell to provide quick access to things like the Get-ChildItem command. As you can see, both commands, dir and Get-ChildItem, return the same data:


You can find an entire list of aliases by entering Get-Alias.

There are also some very nice help options within the ISE. There is a Command Add-on that allows you to select a given command and see what options and parameter are available, as well as the ones that are mandatory. If a field is required, it is denoted by an asterisks. I chose the Get-AdUser cmdlet. As you can see, the Filter: parameter is required. From this Add-On, you can choose to Run, Insert, or Copy the command with the specified parameters.


There is also a new cmdlet named Show-Command that will provide this input box for the requested command if you decide not to have the Command Add-in loaded. Both of these options provide a GUI interface to visually see the required arguments and available parameters for any given command. If you enter Show-Command –Name Get-AdUser in the console, a pop-up window is displayed that contains the same information and functionality provided by the Command Add-On for Get-AdUser.

Another cool feature of the script window within the ISE is the ability to override the PowerShell ExecutionPolicy on a machine. A script is simply a group of commands that are executed together. You can enter this group of commands into the script window and execute them as one. As long as you have not saved the script, this will work around the execution policy. As soon as you save the script, the ExecutionPolicy is enforced and your script may or may not run. To see what your ExecutionPolicy is set to, you can run the cmdlet, Get-ExecutionPolicy. This becomes important if you are trying to run scripts that were downloaded from the internet. If your execution policy is set to Restricted, you will not be able to run these. A way around this is to using the script editor in ISE. You can copy the commands from your downloaded script into a new script window and run it.

I hope that these tips help you. I will continue to provide useful information as I work more with this interface.

Terri is a Support Specialist at OrcsWeb, a hosted server company providing managed hosting solutions.