12

Windows 7 and Windows 2008 R2 potentially can have WMF 2, WMF 3, or WMF 4 installed. Windows 2012 could have WMF3 or 4, and 2012 R2 has WMF 4.

I am looking for a method to find which version is installed. Hopefully this can be found via WMI, so I can use it within both Group Policy filters, and as a check within Powershell scripts I am planning on building that require functionality only available if WMF 3 or 4.

I must be asking the question the wrong way because I am not finding answers on Google.

  • Are you asking how to run something like $PSVersionTable.PSVersion but using WMI? – TheCleaner Nov 14 '13 at 20:40
  • Does the version of $PSVersionTable.PSVersion always correspond to the version of WMF installed? If so, that may be enough. Being able to get that value via WMI would be helpful. – Zoredache Nov 14 '13 at 21:02
  • Would't it be $PSVersionTable.WSManStackVersion though for the WMF version? – ErikE Nov 14 '13 at 21:14
  • @ErikE - I guess it depends on if he needs the Host version or the actual Powershell version. – TheCleaner Nov 14 '13 at 21:57
  • 2
    @Zoredache - If you are looking for a way to make sure you can run a GPO or PS script against a computer, I think you need to first determine if Powershell is even installed and which version it is. This can be done via the registry HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\PowerShellEngine for ver 1 or 2, and HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\3\PowerShellEngine for ver 3 or 4...under the PowerShellVersion value. Is that what you are after? – TheCleaner Nov 14 '13 at 22:00
9

If you are looking for a way to make sure you can run a GPO or PS script against a computer, I think you need to first determine if Powershell is even installed and which version it is. This can be done via the registry HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\PowerShellEngine for ver 1 or 2, and HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\3\PowerShellEngine for ver 3 or 4...under the PowerShellVersion value. Is that what you are after?

The Powershell variable: $PSVersionTable.PSVersion holds info regarding the WMF as well.

  • WMF aka Powershell version is an array: "PSCompatibleVersions {1.0, 2.0, 3.0, 4.0} ". – AnneTheAgile Dec 15 '15 at 20:16
6

You can simply enter "host" in Powershell you will able to view the "Windows Management Framework" version.

PS> (host).Version
Major  Minor  Build  Revision
-----  -----  -----  --------
4      0      -1     -1      
0

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.

Version PS = Version WMF

If you need to update your existing version of PowerShell, in Windows, use the following table to locate the installer for the version of PowerShell you want to update to.

Windows PS 3.0 PS 4.0 PS 5.0 PS 5.1 Windows 10 (see Note1) Windows Server 2016 - - - installed Windows 8.1 Windows Server 2012 R2 - installed WMF 5.0 WMF 5.1 Windows 8 Windows Server 2012 installed WMF 4.0 WMF 5.0 WMF 5.1 Windows 7 SP1 Windows Server 2008 R2 SP1 WMF 3.0 WMF 4.0 WMF 5.0 WMF 5.1

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

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.