Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

http://msdn.microsoft.com/en-us/library/ff637750.aspx claims

Windows PowerShell 2.0 needs to be installed on Windows Server 2008 and Windows Vista only. It is already installed on Windows Server 2008 R2 and Windows 7.

However, powershell.exe lives here %SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe. That doesn't seem like it would be PowerShell 2.0. The file version of powershell.exe is 6.1.7600.16385 so that doesn't help much either.

How do I know for sure if I have Window PowerShell 2.0 installed and if I don't, where is a download link for Windows 7?

share|improve this question

migrated from stackoverflow.com May 7 '11 at 18:35

This question came from our site for professional and enthusiast programmers.

4 Answers 4

up vote 8 down vote accepted

You don't need to dig it out of the registry keys. Just run get-host and check the version.

share|improve this answer
    
Or use the $Host automatic variable. It's marked as implementation-specific in the specification, though (then again, Get-Host doesn't appear at all in the spec). –  Joey May 6 '11 at 17:45
    
Get-Host doesn't appear at all in the spec -> That's weird. They just released that spec a couple of weeks ago. Wonder if that was an oversight? –  mjolinor May 6 '11 at 19:09
    
Well, maybe it's not considered part of the core language cmdlets. $Host is also only implementation-defined. The specification apparently only covers the PowerShell language, not the API and host model. –  Joey May 6 '11 at 19:25
    
It doesn't cover the PSProviders either, but there's a get- for those. –  mjolinor May 6 '11 at 20:14

You can also use $PSVersionTable

PS > $PSVersionTable

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

This var exists only in PowerShell V2.0 and gives th CLR version you use. Normal result is:

PS > $PSVersionTable

Name                           Value
----                           -----
CLRVersion                     2.0.50727.4959
BuildVersion                   6.1.7600.16385
PSVersion                      2.0
WSManStackVersion              2.0
PSCompatibleVersions           {1.0, 2.0}
SerializationVersion           1.1.0.1
PSRemotingProtocolVersion      2.1
share|improve this answer

The location of the PowerShell executable and supporting files wasn't changed for V2, nor was the .ps1 script extension because V2 is fully backward compatible—it replaces V1 rather than needing some side by side mechanism.

share|improve this answer

Figured it out

http://blogs.msdn.com/b/powershell/archive/2009/06/25/detection-logic-poweshell-installation.aspx

To check whether version 1.0 or 2.0 of PowerShell is installed, check for the following value in the registry:
Key Location: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\PowerShellEngine
Value Name: PowerShellVersion
Value Type: REG_SZ
Value Data: <1.0 | 2.0>

share|improve this answer
    
powershell v2 is in the v1.0 directory on win7/2008r2. You couldn't install v1 of powershell on those platforms even if you wanted to. They are system components. IF you are on w7 or r2, you can assume you have v2 or higher powershell. –  x0n May 6 '11 at 15:04

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.