How to check what Windows version you have by running the winver command. Press the Windows + R keyboard keys to launch the Run window, type winver, and press Enter. Open Terminal, Command Prompt (CMD), or PowerShell, type winver, and press Enter. You can also use the search feature to open winver.
Click the Start or Windows button (usually in the lower-left corner of your computer screen). Right-click Computer and choose Properties from the menu. The resulting screen shows the Windows version.
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.Version
Major Minor Build Revision
----- ----- ----- --------
6 1 7601 65536
Details of Windows versions can be found here.
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.
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").ReleaseId
Command 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-List
OS Name : Microsoft Windows 7 Enterprise
OS Version : 6.1.7601 Service Pack 1 Build 7601
OS Manufacturer : Microsoft Corporation
OS Configuration : Standalone Workstation
OS Build Type : Multiprocessor Free
System Type : x64-based PC
System Locale : ru;Russian
Hotfix(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 LTSB
OS Version : 10.0.14393 N/A Build 14393
OS Manufacturer : Microsoft Corporation
OS Configuration : Standalone Workstation
OS Build Type : Multiprocessor Free
System Type : x64-based PC
System Directory : C:\Windows\system32
System Locale : en-us;English (United States)
Hotfix(s) : N/A
Get-ComputerInfo | select WindowsProductName, WindowsVersion, OsHardwareAbstractionLayer
returns
WindowsProductName WindowsVersion OsHardwareAbstractionLayer
------------------ -------------- --------------------------
Windows 10 Enterprise 1709 10.0.16299.371
This will give you the full version of Windows (including Revision/Build number) unlike all the solutions above:
(Get-ItemProperty -Path c:\windows\system32\hal.dll).VersionInfo.FileVersion
Result:
10.0.10240.16392 (th1_st1.150716-1608)
Since PowerShell 5:
Get-ComputerInfo
Get-ComputerInfo -Property Windows*
I think this command pretty much tries the 1001 different ways so far discovered to collect system information...
If you want to differentiate between Windows 8.1 (6.3.9600) and Windows 8 (6.2.9200) use
(Get-CimInstance Win32_OperatingSystem).Version
to get the proper version. [Environment]::OSVersion
doesn't work properly in Windows 8.1 (it returns a Windows 8 version).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With