Windows PowerShell

Posted on April 25, 2007
Filed Under Open Source/Freeware, Software, Windows |

The Windows command shell is intimidating enough to send many users running. Microsoft has spent years trying to distance itself from the command shell and the utterly user unfriendly interface it provides. The shell may well be one of the most despised things in computer history so why would Microsoft release a “PowerShell” now?

The shell is an entirely text based command environment more affectionately known as the “DOS prompt”. The shell has no icons, no buttons, nothing you can click, and in fact, the mouse barely even works in it. In the shell you need to know what commands to type, type them with the right options, and hope that everything goes alright.

The thing with shells is that while they’re not pretty to look at, or particularly easy to work with, they are just plain handy. Scripts for example can be created using a series of shell commands and a single script can then be run that invokes all of the commands contained within it. That may sound somewhat dreary but it can be incredibly useful to automate tasks.

The Windows command shell – or DOS prompt — has always taken a critical back seat to shells available in UNIX and Linux. UNIX and Linux shells are generally much more powerful. They are also more complex and while that’s at least part of the reason UNIX and Linux don’t have the high adoption rate Windows has, their power is undeniable.

Microsoft has tried to bridge that gap in the past with scripting languages like VBScript and technologies such as the Windows Scripting Host (WSH). These technologies never really took off however and were often used to run malicious code; they in fact suffered a great deal of security problems.

On January 30th Microsoft released version 1.0 of its Windows PowerShell. PowerShell expands on the built-in Windows shell and is intended to completely replace VBScript and WSH. PowerShell is indeed powerful but it is also much safer than the older technologies from a security standpoint.

Like VBScript and WSH, PowerShell is able to use variables like any programming language and can manipulate them in any way imaginable. PowerShell is able to treat things like the Windows registry as a file system and allows an administrator to manipulate the registry through PowerShell itself or a PowerShell script.

You can do anything in PowerShell that you can do in the regular Windows shell. For example in a regular command shell you can type “ipconfig” (without the quotes) and when you press enter, you’ll get information about your network settings. In PowerShell you’ll get the same information when you type “ipconfig”.

PowerShell adds to that with “cmdlets” (pronounced “command-lets”); small bits of functionality that can retrieve and change information. cmdlets are accessed in the form of “verb-noun”. For example the cmdlet “Get-Date” retrieves the current date while “Set-Date” sets the date to whatever you specify.

The primary security feature in Windows PowerShell is its execution policy and by default, this policy is set to Restricted. you can confirm this by running the Get-ExecutionPolicy cmdlet and if you want to change the execution policy (be careful) you would run Set-ExecutionPolicy. The four execution policies are Restricted, AllSigned, RemoteSigned, and Unrestricted.

Using PowerShell is an in-depth subject and far beyond the scope of anything we could do in the column. The tool is powerful and more secure than its predecessors and if you need to automate tasks or really dig deep into the Windows innards, PowerShell is probably for you.

Comments

Leave a Reply

You must be logged in to post a comment.