Prof. Powershell

PowerShell 2.0 or Bust!

Windows 7 is hitting the streets, and so is PowerShell 2.0. The better, faster PowerShell.

By the time you read this Windows 7 should have hit the streets, obtaining the all-important "General Availability" status.

Windows Server 2008 R2 will be close behind. What this means for us is that PowerShell 2.0 is also officially released. When you install Windows 7 and Windows Server 2008 R2, you will get the latest, most whiz-bang console-based management tool installed by default. I think it was another PowerShell MVP who opined, "Buy PowerShell 2.0 and get Windows 7 for free!"

The PowerShell team at Microsoft is hard at work on releases for older operating systems, and once released you'll want to upgrade. The driving force for upgrading is the remoting feature in PowerShell 2.0. While Windows Management Instrumentation (WMI) is still around, we'll be using Windows Remote Management (WinRM) to securely connect to remote machines.

In PowerShell 2.0 you'll be able to establish a secure telnet-like session with as many remote computers as you wish. However this will require PowerShell 2.0 on your system and all the computers you want to manage remotely.

Because PowerShell v2.0 is where you need to be, you should assume that future Prof. PowerShell columns will be based on it, unless otherwise noted.

So how can you tell if you have PowerShell 2.0? Look at the $psversion variable:

PS C:\> $psversiontable

Name Value
---- -----
CLRVersion                 2.0.50727.4927
BuildVersion               6.1.7600.16385
PSVersion                  2.0
WSManStackVersion          2.0
PSCompatibleVersions       {1.0, 2.0}
SerializationVersion       1.1.0.1
PSRemotingProtocolVersion  2.1

You can see that PSVersion is 2.0.

All of your PowerShell v1.0 scripts should continue to run. The file extension is still .ps1. If you have a script or function that requires version 2.0, you can insert a comment like this at the beginning of your script:

#Requires -version 2.0

The release notes for PowerShell v2.0 can be found in an about help file:

PS C:\> help About_Windows_Powershell_2.0

We're in for a great adventure. Are you ready?

About the Author

Jeffery Hicks is an IT veteran with over 25 years of experience, much of it spent as an IT infrastructure consultant specializing in Microsoft server technologies with an emphasis in automation and efficiency. He is a multi-year recipient of the Microsoft MVP Award in Windows PowerShell. He works today as an independent author, trainer and consultant. Jeff has written for numerous online sites and print publications, is a contributing editor at Petri.com, and a frequent speaker at technology conferences and user groups.

comments powered by Disqus
Most   Popular

Upcoming Training Events