Get Windows version info in Powershell

article #1338, updated 20 days ago

Here’s a great place to start:

Get-CimInstance -Class Win32_OperatingSystem | ForEach-Object -MemberName Caption

This gets profoundly useful strings like “Microsoft Windows 10 Enterprise”. If you need the numeric version, the best so far has been:

(Get-ItemProperty -Path c:\windows\system32\hal.dll).VersionInfo.FileVersion

which, right now on this machine, gets us “10.0.18362.387 (WinBuild.160101.0800)”. And for the Windows 10 build:

(Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion' -Name ReleaseID -ErrorAction Stop).ReleaseID

which gets “1903”. All of these are fast, do not depend on systeminfo, and appear to be nice and reliable.

Categories: