
We used the switch version that was answered before and just elaborated on it. I wanted to just complete a small script. Note: As you can see I used the above just for server systems, however it could easily be applied to workstations or even cleverly extended to support both. Write-Host "Server system: $OS" -foregroundcolor Green So from there I could do something along the lines of: switch ((Get-CimInstance Win32_OperatingSystem).BuildNumber) The choice is yours which ever way you prefer it. Or by: (Get-CimInstance Win32_OperatingSystem).buildNumber The build number may be attained either by: (::OSVersion.Version).Build Since my interest is to know which exact windows OS I am dealing with, I left aside the entire version rainbow and instead focused on the BuildNumber. I came across this site: Version & Build Numbers that provided a clear overview of what is what in the Microsoft Windows world. This is really a long thread, and probably because the answers albeit correct are not resolving the fundamental question. System Locale : en-us English (United States) Windows 10 output for the same command: OS Name : Microsoft Windows 10 Enterprise N 2016 LTSB OS Configuration : Standalone Workstation


Powershell wrapper: PS C:\> systeminfo /fo csv | ConvertFrom-Csv | select OS*, System*, Hotfix* | Format-List

Reg Query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v ReleaseIdĪs for other Windows versions use systeminfo. (Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion").ReleaseId Unfortunately most of the other answers do not provide information specific to Windows 10.
