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!

1

1 Answer 1

2

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

Get-ItemPropertyValue 'HKLM:\Software\Microsoft\Windows NT\CurrentVersion' 'UBR' 
3
  • 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. Commented Sep 25, 2020 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! Commented Sep 25, 2020 at 13:00
  • As an alternative, you could also parse out of (Get-ItemProperty -Path c:\windows\system32\hal.dll).VersionInfo.FileVersion Commented Oct 12, 2021 at 22:14

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.