Microsoft releases Windows PowerShell, a powerful replacement for cmd.exe

Microsoft released a new and more powerful command line shell and task based scripting technology called Windows PowerShell today. Powershell brings in Unix style shell scripting to Windows Vista as well as Windows XP and Windows 2003 platforms.

Powershell supports features like pipelines(dir | more), allows you to quickly solve storage problems for instance how many 700MB cds are needed to backup 11GB? (11GBMB/700MB) Alex of Windows Vista blog has a more simple definition of Powershell. He describes Powershell as “If you haven’t heard of Windows PowerShell before, think of it as an integrated version of the Windows Command Prompt (cmd.exe) and VBScript.”

You can use it to unleash the power of wildcards and working objects too. Say you wanted to get all the services that start with “a” and then get all the dependent services associated with it, simply typing “PS> get-service w* | format-list DisplayName, DependentServices” should do the job.

History: Before being released as Windows Powershell, it was previously known as Windows “Monad” Shell and MSH or Microsoft Command Shell.

Prerequisites: Windows PowerShell requires the .Net Framework 2.0. You can download Framework 2.0 here

Cool New Features/ can do with Win PowerShell …. I think I will call it Win Pow

1. You can test your commands before committing to them(use feature called Whatif )

2. You can start and stop transcripts of all your commands

3. Can use Win Pow to access applications such as Windows Media Player 11

4. Can configure the much hated User Account Control (set-itemproperty -path HKLM:\SOFTWARE\MICROSOFT\WINDOWS\CurrentVersion\Policies\System -name ConsentPromptBehaviorAdmin -value 0) where a 0 will turn of UAC and 2 will turn it back on.

Look at the example below where I display the services and use powershell as a calender calculator

Windows Powershell example

In the example above, I can get all the services starting with w by saying PS> Get-Service w*. A neat feature is that if you press Get-Ser and key, powershell auto fills the command for you. In the example following that, I am using Windows Powershell as a calender calculator by pressing PS>([DateTime]”1/1/2007″ -[datetime]::now).days which gave me back 47 days to go for new year 2007.

Click below to watch the MSDN video (the DFO Show) by David Aiken, Powershell Architect Evangelist and Jeffrey Snover, Windows Powershell architect.

Windows Powershell Video

More Links

1. Download Windows PowerShell from Microsoft for Windows Vista, Windows XP, Windows 2003

2. Windows PowerShell Script center on Microsoft TechNet

3. Windows Powershell blog on MSDN

4. How to use Unix/Linux commands at the traditional command prompt from AskStudent