2

Winver VS Powershell Output

Hello Guys! Why is Winver showing me Windows Version 21H2 but Powershell Command 2009?

Get-ComputerInfo | select WindowsProductName, WindowsVersion

Info: With my Personal PC at home Windows 11 Pro 21H2, it works with the command

Get-ComputerInfo | Select-Object -expand OSDisplayVersion

Unfortunately this Property doesn`t exist at my Laptop, or maybe in general at Win10 Enterprise?

Linne
  • 41
  • 3
  • Do you have some Powershell code that depends on the newer version? Please post your code... – Anders May 05 '22 at 14:57

1 Answers1

3

You can mimic the way winver.exe shows the current Windows version by taking the values from the registry:

$v = Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion'
# output like winver does
'Version {0} (Build {1}.{2})' -f $v.DisplayVersion, $v.CurrentBuildNumber, $v.UBR

Output:

Version 21H2 (Build 19044.1645)

UBR means Update Build Revision

Theo
  • 57,719
  • 8
  • 24
  • 41
  • Looking in the `C:\Windows\servicing\Packages` directory, the most recent `*.mum` files are showing `10.0.19041.2311`, but your script above shows `19044.2364`. What's going on? – not2qubit Dec 17 '22 at 23:26