Prof. Powershell

PowerShell 2 and 3, Side by Side

Here's something nifty: you don't have uninstall PowerShell 2 to use version 3.

When I was a kid I often heard my mom singing, "Just to travel along, singing a song, side by side." It is still a catchy tune, but you're probably wondering what this has to do with PowerShell. Well, when PowerShell 2.0 came out, if you wanted to run it you had to install it in place of PowerShell 1.0. There was no provision for running the two versions on the same box, no "side by side." Generally, this wasn't a problem because of backwards compatibility. But many would have preferred a side-by-side installation.

Now we have PowerShell 3.0, which is in CTP2 as of this writing. This version has been architected so that you can in effect run versions 2.0 and 3.0 side by side. PowerShell 1.0 has left the building, despite the fact that the install path still reflects 1.0:

PS C:\> $pshome

For the most part, that doesn't really matter. What does matter is that now you can start a PowerShell 2.0 session on a machine running PowerShell 3.0. You can test it like this. If you have 3.0 installed, take a look at the $PSVersionTable variable:

PS C:\> $psversiontable

Name                       Value
----                       -----
WSManStackVersion          3.0
PSCompatibleVersions       {1.0, 2.0, 3.0}
BuildVersion               6.2.8158.0
PSVersion                  3.0
CLRVersion                 4.0.30319.239
PSRemotingProtocolVersion  2.103

Notice the PSVersion property. To "switch" to PowerShell v2.0, all we need to do is start a new instance and specify the version. We can do this right from the current PowerShell prompt.

PS C:\> powershell -version 2.0
Windows PowerShell
Copyright (C) 2009 Microsoft Corporation. All rights reserved.

PS C:\> $psversiontable

Name                       Value
----                       -----
CLRVersion                 2.0.50727.5448
BuildVersion               6.1.7601.17514
PSVersion                  2.0
WSManStackVersion          2.0
PSCompatibleVersions       {1.0, 2.0}
PSRemotingProtocolVersion  2.1

The PSVersion property has changed. Did you also notice the copyright notice? That is right out of v2.0. I can run all the commands and scripts I want and they will run in a PowerShell 2.0 session. I cannot access v3.0 features.

PS C:\> update-help
The term 'update-help' is not recognized as the name of a cmdlet, function, scr
ipt file, or operable program. Check the spelling of the name, or if a path was
 included, verify that the path is correct and try again.
At line:1 char:12
+ update-help <<<<
+ CategoryInfo          : ObjectNotFound: (update-help:String) [], Command
+ FullyQualifiedErrorId : CommandNotFoundException

Although I can still see thinks like v3.0 About files. When I'm finished, I simply type Exit. If you think you need to use v2.0 often, create a new shortcut on your desktop or Start menu to execute powershell.exe -version 2.0. You can get additional options from command help:

C:\> powershell -?

Note: This information is based on PowerShell 3.0 CTP 2 which is subject to change, and most likely will, prior to release.

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, and a frequent speaker at technology conferences and user groups.

comments powered by Disqus
Most   Popular

SharePoint Watch

Sign up for our newsletter.

Terms and Privacy Policy consent

I agree to this site's Privacy Policy.