Windows 8 – Administrative Tools – Windows PowerShell ISE

Historically, the command-line support in Windows has always been considered laughable in spite of the scripting languages like VBScript and Jscript.

These languages are not natively integrated into the shell, have a meager documentation, and have a lot of exploitable vulnerabilities.

However, the day Windows PowerShell released, *NIX geeks had to throw their Windows command-line related trolling out of the window.

Windows PowerShell is an extremely powerful command-line automation framework built on top of .NET framework. It also provides full access to the ancient COM and WMI components of Windows.

Thus, you can user PowerShell to tweak any corner of Windows. It provides a very powerful programming interface. You can write PowerShell script to manage all kinds of administrative tasks on Windows.

The commands in PowerShell are called cmdlets, pronounced as command-lets. A cmdlet is a .NET class, designed to do a single task. A cmdlet can channel its output to another cmdlet.

Thus, one can combine several cmdlets to perform any kind of administrative task. A PowerShell script is a collection of several cmdlets to perform a task.

PowerShell itself provides a very basic command-line interface to write and execute scripts. This can become a huge pain in case you wish to write lengthy scripts.

Microsoft has mitigated this need by introducing PowerShell Integrated Scripting Environment. It is a GUI-based PowerShell host that provides integrated debugger, syntax highlighting, tab completion, a tabbed UI, as well as the ability to run only the selected parts in a script.

How to Launch It

Control Panel Way

  • Open “Administrative Tools” applet from the traditional Control Panel.
  • Launch “Windows PowerShell ISE” from the list of administrative tools.

Command Way

  • Invoke Run window or Search Charm. Select the Settings tab in case of Search Charm.
  • Type in the command “PowerShell_ISE.exe”, and hit Enter.

The so-launched window looks similar to an Integrated Development Environment.

Display Structure

The ISE is divided into three panes.

  • Scripting Pane – This is the pane where your write PowerShell script. The barebones console PowerShell gives a real pain if you want to write multiline scripts. This pane is a much more viable option than that.
  • Console Pane – The results of your executed scripts show up here. Additionally, you can directly type in PowerShell cmdlets in the window, in case you want to do some rapid “PowerShelling”.
  • Commands Add-on Pane – Did a cmdlet just miss your brain? No worries. You can look up for it in this pane. It lists all the cmdlets provided by PowerShell, categorized depending on which Windows Module they belong to.

As an example, I have written a two-line script in the scripting pane.

The first line uses a simple echo (an alias of Write-Host) command to print a message “Number of the current week of 2012 is –“.

The following line runs a cmdlet Get-Date that fetches today’s date. By passing it two attributes to it, I asked the cmdlet to morph the output to display only the current number of week.

When I ran the script, it displayed the desired output in the console pane.

Features of PowerShell ISE

ISE provides several rich development features like:

  • Multiline editing – My example is a two-line, nevertheless, a multiline script.
  • Tab completion – Type in several letters, and then hit Tab key. PowerShell will complete whatever you are typing with the closest match. You can keep pressing Tab till you get the desired result.
  • IntelliSense – Tab completion is a rudimentary feature. Being a rich development environment, ISE also provides IntelliSense. While typing something, if you hit Control+Enter key combo, then ISE presents you with a list of possible commands. The above figure shows a dropdown autocomplete list. The IntelliSense feature is not just limited to completing cmdlets; it can aide you by providing suggestions for parameters, values, paths, variables, properties, methods, etc.
  • Syntax coloring – It gives you the feel of an IDE.
  • Selective Execution – One of the cool features of ISE. You can select some part of your script and run it independently. Select the desired part, and hit F8. PowerShell will execute only the selected script and display the result in console pane.
  • Debugging – You can debug a lengthy script. You can insert breakpoints for that.
  • Tabbed UI – Work with several scripts together by opening them in several tabs.

Please Leave Your Comments Below...