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
Should be easy like this :
Get-ComputerInfo | select windowsversion
You can use python, to simplify things (works on all Windows versions and all other platforms):
import platform
print(platform.system()) # returns 'Windows', 'Linux' etc.
print(platform.release()) # returns for Windows 10 or Server 2019 '10'
if platform.system() = 'Windows':
print(platform.win32_ver()) # returns (10, 10.0.17744, SP0, Multiprocessor Free) on windows server 2019
I took the scripts above and tweaked them a little to come up with this:
$name=(Get-WmiObject Win32_OperatingSystem).caption
$bit=(Get-WmiObject Win32_OperatingSystem).OSArchitecture
$vert = " Version:"
$ver=(Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion").ReleaseId
$buildt = " Build:"
$build= (Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion").BuildLabEx -match '^[0-9]+\.[0-9]+' | % { $matches.Values }
$installd = Get-ComputerInfo -Property WindowsInstallDateFromRegistry
Write-host $installd
Write-Host $name, $bit, $vert, $ver, `enter code here`$buildt, $build, $installd
To get a result like this:
Microsoft Windows 10 Home 64-bit Version: 1709 Build: 16299.431 @{WindowsInstallDateFromRegistry=18-01-01 2:29:11 AM}
Hint: I'd appreciate a hand stripping the prefix text from the install date so I can replace it with a more readable header.
To produce identical output to winver.exe in PowerShell v5 on Windows 10 1809:
$Version = Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\'
"Version $($Version.ReleaseId) (OS Build $($Version.CurrentBuildNumber).$($Version.UBR))"
Using Windows Powershell, it possible to get the data you need in the following way
Caption:
(Get-WmiObject -class Win32_OperatingSystem).Caption
ReleaseId:
(Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion" -Name ReleaseId).ReleaseId
version:
(Get-CimInstance Win32_OperatingSystem).version
(Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion" -Name BuildLabEx).BuildLabEx