How do I find which Windows version I\'m using?
I\'m using PowerShell 2.0 and tried:
PS C:\\> ver
The term \'ver\' is not recognized as the name o
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