2

I have this issue. Using just command "ver" in batch I get: Microsoft Windows [Version 10.0.18363.900]

I need the last sub-build version (900) for an script to determine if windows is on latest patch level (or close to it, after checking the main build version too) My script works perfect on windows 10, windows 2019 but not in windows 2016, since "ver" will print: Microsoft Windows [Version 10.0.14393]

Without the sub-build version. When checking "WinVer" will print on GUI: Version 1607 (OS Build 14393.3930)

So, in windows 2016 where I can get that "3930" from batch or powershell? WMI, sysinfo, etc wont show that.

THANKS!

DefToneR
  • 527
  • 6
  • 14
  • 1
    Apply this article: [Windows 10 tip: Find and decode secret version details](https://www.zdnet.com/article/windows-10-tip-decode-detailed-version-information/); the value on the right side of the dot in _OS Build_ identifies the most recent cumulative update that's been installed. Use Microsoft's web-based secret decoder ring, also known as the [Windows 10 and Windows Server 2016 update history](https://support.microsoft.com/en-us/help/4577015). – JosefZ Sep 23 '20 at 22:54

1 Answers1

2

It's called the Update Build Revision. Use the following command to query it:

Get-ItemPropertyValue 'HKLM:\Software\Microsoft\Windows NT\CurrentVersion' 'UBR'  
Greg Askew
  • 35,880
  • 5
  • 54
  • 82
  • Thank you so much, I searched registry by hand looking for it and I found it in several random places (like internet explorer version...) I cant believe that I missed the CurrentVersion Key. – DefToneR Sep 25 '20 at 12:43
  • Just adding that I ended up using batch, so to avoid converting the hex to dec (UBR is set in hex) I used "BuildLabEx" and parsed the result: for /f "tokens=3" %%a in ('reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v "BuildLabEx"') do set _Patch=%%a set _PatchClean=!_Patch:~6,4! – DefToneR Sep 25 '20 at 13:00
  • As an alternative, you could also parse out of (Get-ItemProperty -Path c:\windows\system32\hal.dll).VersionInfo.FileVersion – Dallas Oct 12 '21 at 22:14