Share via


Get build number + patchlevel (e.g. 14392.XXX) from commandline as string

Question

Wednesday, September 21, 2016 7:53 AM

Hi everyone,

this seems to be a very simple question but even after searching the web for 1 hour now I couldn't find a way to accomplish this:

I'm writing some batches right now for our client network and need to get the complete patchlevel from the client computer. Windows 10 makes this very important because of the fractioned build versions with very different stabilities and functions. However, the patchlevel delivered (graphical) by winver can not be obtained through ver*, systeminf*o or wmic (all cli-based, which is what I need) - these just give out the build number, not the patch level.

So what I'm asking is: Does anyone know

a) a system file where I can extract/parse the patchlevel (This is my understanding of how winver determines it?

or even more comfortable:

b) a command that delivers it (as complete XXXXX.YYY)?

Thanks in advance and best regards,

RP

All replies (4)

Wednesday, September 21, 2016 7:50 PM âś…Answered | 1 vote

PowerShell;

$PSVersionTable.BuildVersion.ToString().

Give the BuildVersion for me, to remove the 10.0 at the start;

$PSVersionTable.BuildVersion.ToString().Substring(5,$PSVersionTable.BuildVersion.ToString().Length-5)

That gives it in my test, any use?


Thursday, September 22, 2016 5:04 PM

This is exactly what I was looking for and proves to me one more time that I should consider PS more often!

Thanks a lot for this hint,

RP


Wednesday, October 17, 2018 3:23 PM

Hi,

from my understanding this gives the Powershell build version.

Although from windows 10, it matches the OS version and patch level, on other OSes it doesn't match.

For example, on window2003 BuildVersion gives 6.0.6002.18111 which is a windows2008 version and build number not a 2003.


Wednesday, October 17, 2018 5:24 PM

Hi,

from my understanding this gives the Powershell build version.

Although from windows 10, it matches the OS version and patch level, on other OSes it doesn't match.

For example, on window2003 BuildVersion gives 6.0.6002.18111 which is a windows2008 version and build number not a 2003.

This is a Windows 10 forum, so I answered for Windows 10. I do not have a 2003 system to test (nor it is a supported OS). Try;

systeminfo | findstr OS

or

reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" | findstr BuildLabEx

Either them get the build number?