How to find the Windows version from the PowerShell command line How to find the Windows version from the PowerShell command line powershell powershell

How to find the Windows version from the PowerShell command line


Since you have access to the .NET library, you could access the OSVersion property of the System.Environment class to get this information. For the version number, there is the Version property.

For example,

PS C:\> [System.Environment]::OSVersion.VersionMajor  Minor  Build  Revision-----  -----  -----  --------6      1      7601   65536

Details of Windows versions can be found here.


  1. To get the Windows version number, as Jeff notes in his answer, use:

    [Environment]::OSVersion

    It is worth noting that the result is of type [System.Version], so it is possible to check for, say, Windows 7/Windows Server 2008 R2 and later with

    [Environment]::OSVersion.Version -ge (new-object 'Version' 6,1)

    However this will not tell you if it is client or server Windows, nor the name of the version.

  2. Use WMI's Win32_OperatingSystem class (always single instance), for example:

    (Get-WmiObject -class Win32_OperatingSystem).Caption

    will return something like

    Microsoft® Windows Server® 2008 Standard


Unfortunately most of the other answers do not provide information specific to Windows 10.

Windows 10 has versions of its own: 1507, 1511, 1607, 1703, etc. This is what winver shows.

Powershell:(Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion").ReleaseIdCommand prompt (CMD.EXE):Reg Query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v ReleaseId

See also related question on superuser.

As for other Windows versions use systeminfo. Powershell wrapper:

PS C:\> systeminfo /fo csv | ConvertFrom-Csv | select OS*, System*, Hotfix* | Format-ListOS Name             : Microsoft Windows 7 EnterpriseOS Version          : 6.1.7601 Service Pack 1 Build 7601OS Manufacturer     : Microsoft CorporationOS Configuration    : Standalone WorkstationOS Build Type       : Multiprocessor FreeSystem Type         : x64-based PCSystem Locale       : ru;RussianHotfix(s)           : 274 Hotfix(s) Installed.,[01]: KB2849697,[02]: KB2849697,[03]:...

Windows 10 output for the same command:

OS Name             : Microsoft Windows 10 Enterprise N 2016 LTSBOS Version          : 10.0.14393 N/A Build 14393OS Manufacturer     : Microsoft CorporationOS Configuration    : Standalone WorkstationOS Build Type       : Multiprocessor FreeSystem Type         : x64-based PCSystem Directory    : C:\Windows\system32System Locale       : en-us;English (United States)Hotfix(s)           : N/A