13

How do you check to see what version of Windows Management Framework (WMF) is installed? It seems like it should be a simple thing to find out, but I cannot. Even Googling a bunch of different versions of the question turns up little to nothing.

It's not in appwiz.cpl, and regedit doesn't find anything for "Windows Management Framework" and it finds too much extraneous stuff for "wmf"

I just want to know how to check it at all, in any reasonable way. Is there a registry key for it? Is there a file I can check? Anything???

The closest thing I could find was here on serverfault: Methods to Detect version of Windows Management Framework. That question starts off the same, but it seems to ask for a specific way of checking to be used in a GPO; perhaps that is why it got no answers.

There are multiple computers I want to check this on. The one I'm starting with is Windows Server 2008 R2 Standard. There will be other Windows Server operating systems as well.

If you know of any tags that work better than what I have, please comment or retag; I couldn't find anything that described this question well.


Update: Some people seem to think that "$PSVersionTable" (and/or various properties of it) is an answer. I finally realized recently that this is a PowerShell variable (maybe 'PS' prefix should have given it away for me, but it didn't) and tried to dig deeper. This resulted in another question: What do the contents of PowerShell's $PSVersionTable represent?.

Update2: Based on all the information I've gathered now and my better understanding, I'm fairly certain that PowerShell's built-in variable $PSVersionTable.PSVersion is not technically the answer to this, but that it is often (sometimes? always? not sure) the same, as in the versions might go hand-in-hand. The $PSVersionTable.WSManStackVersion variable might be what I want, but the official short description of that property shows it as representing the WS-Management stack. Is the WS-Management stack the same thing as WMF? Googling suggests they are closely related, but I'm not sure if the answer to that is yes.

  • 1
    Possible dupe of: serverfault.com/questions/555100/… Answer is in the comments even though there is no accepted answer yet. – Wesley Sep 9 '14 at 19:24
  • @Wesley I already provided a link to that question and mentioned it. The answer is not in the comments. "Are you asking how to run something like $PSVersionTable.PSVersion but using WMI?" is not an answer. What does that even mean? If you could take that comment and turn it into an answer that is actually usable, I would appreciate it. Is this $PSVersionTable.PSVersion a variable of some type that is available somewhere? If yes, is it guaranteed to be the WMF version? I tried echo $PSVersionTable.PSVersion and got an output of $PSVersionTable.PSVersion – Loduwijk Sep 10 '14 at 18:46
  • Also, the same goes for the similar comments of that question. – Loduwijk Sep 10 '14 at 18:47
  • 1
    You probably got downvoted for saying you ran echo $PSVersionTable.PSVersion and got an output of $PSVersionTable.PSVersion - what are you confused by in my comment/answer on the other question? – TheCleaner Sep 10 '14 at 19:53
  • 1
    Saying "I did this and got this result" should never produce a downvote. That insinuates that you are downvoting because you think the person is stupid. That was just an example of one way in which I was trying to make use of the supposed "answer." The comments with that variable gave some data but no useful way to use it. I did not know that it is a variable in PowerShell, and nobody said that it was - the closest thing was that a couple people mentioned checking PowerShell version too, which is something I was not looking for. – Loduwijk Sep 10 '14 at 20:26
8

See this documentation from Microsoft:

https://docs.microsoft.com/en-us/powershell/scripting/setup/installing-windows-powershell?view=powershell-5.1

In the "Upgrading existing Windows Powershell" section, it says specifically:

The installation package for PowerShell comes inside a WMF installer. The version of the WMF installer matches the version of PowerShell; there's no stand alone installer for Windows PowerShell.

I think this is the answer guys. Run $PSVersionTable.PSVersion to get the version.

  • Finally a definitive, authoritative answer straight from Microsoft. Thank you. Accepted and +1. – Loduwijk Sep 21 '17 at 0:28
10

I know this is an old question, but for others that find this from a Google Search:

I would like to argue that $PSVersionTable.PSVersion is the most reliable indicator of the version of WMF. See below examples.

Windows 7 fresh install:

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

Windows 7 after .NET 4.5 and WMF 4 installation:

Name                           Value
----                           -----
PSVersion                      4.0
WSManStackVersion              3.0
SerializationVersion           1.1.0.1
CLRVersion                     4.0.30319.18408
BuildVersion                   6.3.9600.16406
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0}
PSRemotingProtocolVersion      2.2

Windows 7 after WMF 5 installation:

Name                           Value
----                           -----
PSVersion                      5.0.10586.117
WSManStackVersion              3.0
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.10586.117
CLRVersion                     4.0.30319.18408
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Windows 10, which includes WMF 5 out of the box:

Name                           Value
----                           -----
PSVersion                      5.0.10586.122
WSManStackVersion              3.0
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.10586.122
CLRVersion                     4.0.30319.42000
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

So as you can see, the version for $PSVersionTable.WSManStackVersion.Major only seems to change on the WMF 4 install and then stays at 3. While $PSVersionTable.PSVersion.Major seems to report the accurate version of WMF.

  • I'll tell you what the most reliable indicator would be. Find the default WMF for each version of Windows, and what KB numbers are used for each Windows Management Framework, and then check for those versions/KBs and do a big case statement. I mean, probably PSVersion is good enough, but as has been pointed out, we don't know that. Or, at least, I don't know that. But I can tell you for sure if you had the KBs and the OS version, you would know what WMF had been installed. (Taking a step back, though, I'm curious about why one needs to know WMF version and PSVersion wouldn't be sufficient.) – Todd Walton Aug 30 '16 at 15:59
  • This should be the accepted answer. While finding all the KBs would enable an exhaustive answer, this answer is a reasonable approach that I can confirm on at least one Windows version (2012 R2). – RichVel Mar 13 '17 at 15:44
  • @ToddWalton I do not remember the specifics about why I needed WMF version at that time. All I remember is that something I was doing had a prerequisite that a specific version of WMF was installed, and it was not PowerShell. I don't remember what it was though, so maybe it was something that used PowerShell. I have not even been at that job for about 2 years now though, so my memory of that task is swiss cheesey. – Loduwijk Sep 21 '17 at 0:35
  • @RichVel You were right, that answer should have been the accepted one. Not sure why I never switched the check-mark to that one. At this point, though, an actually definitive, authoritative answer has been provided recently, so I have accepted that one instead. Sorry to Mike that his answer wasn't checked for the last year. – Loduwijk Sep 21 '17 at 0:37
3

In PowerShell it's available from $PSVersionTable.WSManStackVersion.Major

My home Windows 7 system:

PS C:\Users\Brian> $PSVersionTable

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


PS C:\Users\Brian> $PSVersionTable.WSManStackVersion.Major
2
PS C:\Users\Brian>

Then after installing a newer Windows Management Framework:

PS C:\Users\Brian> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      4.0
WSManStackVersion              3.0
SerializationVersion           1.1.0.1
CLRVersion                     4.0.30319.34209
BuildVersion                   6.3.9600.16406
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0}
PSRemotingProtocolVersion      2.2


PS C:\Users\Brian>
  • 1
    I believe this is incorrect. I just installed WMF 5.1 on a Windows Server 2012 R2 system, on which WSManStackVersion was originally 3.0, and it remained at 3.0. I think the best guide is the first two components of PSVersion which will be the same as the WMF version. – RichVel Mar 13 '17 at 15:42
0

If it's installed, you will find it in "appwiz.cpl". Just remember to look under "View installed updates", as the WMF is distributed as a Windows update with unique KB-numbers for the different Windows versions.

WMF 3.0 installed under Windows 7 SP 1

0

You check to see what version of Windows Management Framework (WMF) is installed by identifying the KB number of the version you are checking for and then using, in this case, a wmic query, to determine if that KB number has been installed. These examples are all based on using cmd.exe to run the commands.

** Commands to Check for WMF 4.0

wmic qfe get hotfixid | find "KB2819745"
echo %ERRORLEVEL%

** Example of running the commands:

C:\Program Files\Tivoli\TSM\baclient> wmic qfe get hotfixid | find "KB2819745"
KB2819745

C:\Program Files\Tivoli\TSM\baclient> echo %ERRORLEVEL%
0

In the above example WMF 4.0 is installed: The KB is returned from the wmic query and a zero return code.

** Commands to Check for WMF 5.0

wmic qfe get hotfixid | find "KB3134760"
echo %ERRORLEVEL%

** Example of running the commands:

C:\Program Files\Tivoli\TSM\baclient> wmic qfe get hotfixid | find "KB3134760"
C:\Program Files\Tivoli\TSM\baclient> echo %ERRORLEVEL%
1

So in the above example WMF 5.0 is not installed: nothing returned from the wmic query and a non-zero return code.

It is possible that you used a different KB to install a given level of WMF but these are what I'm working with currently.

And I always check PowerShell (which is installed or upgraded as part of WMF):

powershell.exe -NoLogo -Sta -NoProfile -NonInteractive -Command "Write-Host $PSVersionTable.PSVersion"
echo %ERRORLEVEL%

There are issues when upgrading to WMF 4.0 (and again later to 5.0) if .NET 4.5 is not installed so if the PS command outputs an error you should probably install .NET 4.5.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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