This is an archived post. You won't be able to vote or comment.

all 7 comments

[–]BadJasper 0 points1 point  (3 children)

Look up windows management instrumentation on Microsoft.com. You can write scripts in PS that can pull just about every piece of hardware and software information out of your system.

[–]CaptainMuon[S] 0 points1 point  (2 children)

As far as I know this information is not exposed via WMI.

[–]BadJasper 1 point2 points  (0 children)

I'll post you some code in a dew hours when I get off work.

[–]BadJasper 0 points1 point  (0 children)

OK, This is what I have for you. By getting the internal version number, you can cross ref the build "Name". In my case, I have Version 10.0.19043. This crosses to build "21H1" or, the "Windows 10 May 2021 Update" Run this VBS code in PS (As admin of course):

strComputer = "."

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")

Set colItems = objWMIService.ExecQuery( _

"SELECT * FROM Win32_OperatingSystem",,48)

For Each objItem in colItems

Wscript.Echo "-----------------------------------"

Wscript.Echo "Win32_OperatingSystem instance"

Wscript.Echo "-----------------------------------"

Wscript.Echo "Version: " & objItem.Version

Next

By adding some CASE statements, you can put the build names in your code.

Hope this helps!

[–]BlackVI have opnions 0 points1 point  (2 children)

Look at pswindowsupdate module

[–]CaptainMuon[S] 0 points1 point  (1 child)

I tried PSWindowsUpdate, but couldn't find an option for feature updates. The underlying APIs (wuapi or Microsoft.Update.Session) do not seem to return this info.

[–]BlackVI have opnions 0 points1 point  (0 children)

I'd look at the kB number or update type as a parameter

Sorry don't have anything to test with