BatchPatch Forums Home › Forums › BatchPatch Support Forum › get date of last successfully installed update
Tagged: last installed update
- This topic has 3 replies, 2 voices, and was last updated 3 years, 3 months ago by doug.
-
AuthorPosts
-
August 27, 2021 at 6:34 am #13037jazzwormParticipant
Hi,
In the past I was using following powershell command in a “remote command with logged output” to get the date of the last successfully installed update on Win10 clients.
cmd.exe /c echo . | powershell.exe -ExecutionPolicy Bypass -command "(new-object -com "Microsoft.Update.AutoUpdate").Results.LastInstallationSuccessDate[0].ToString('yyyy-MM-dd')"
This was very helpful as you could sort the hosts in a grid for it to get a fast impression which systems need to be taken care most urgently.
It was working fine until Win10 21H1 (19043) has been released.
Not sure what kind of date is given back exactly now on systems running 21H1, but it’s obviously no longer the correct date of the last installed update.Does anybody know what was changed and maybe has an idea what can be used instead?
BP is still able to list all updates installed correctly when using the “Generate consolidated report of update history” feature, so it must be possible somehow …Many Thanks
August 27, 2021 at 4:46 pm #13042dougModeratorI’m curious which version of Windows were you using this successfully on? I don’t think this value started being wrong in 21H1. I think it was long before that. But I’d be curious to know which OS you were most recently using this successfully. Also, what is the actual value that you see? 1601-01-01 ?
Realistically Microsoft should fix this or deprecate/remove it from the API. However, I wouldn’t hold my breath, as their quality control has been only getting worse in recent years.
One possibility would be to query this registry value, which is the update build revision. Essentially it indicates which cumulative update was most recently applied, and it seems like the closest thing to what you’re looking for:
powershell.exe -command "$key = 'Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion'; $value = 'UBR'; (Get-ItemProperty -Path $key -Name $value).$value"
So, for example if you have OS build 19042, and you have UBR 1110, then you have 19042.1110. If your machines are generally on the same OS build, then you could just look at UBR to get a quick idea of which machines are behind on the monthly cumulative update.
August 30, 2021 at 9:28 am #13043jazzwormParticipantHi Doug,
thanks for your reply. It worked (and still works) fine through all Win10 versions incl. 19042 and started coming up with strange values after installing 19043.
Yes, in many cases it returns 1601-01-01 now but not allways.
Some hosts which showed 1601-01-01 at the beginning returned another date few days later, which again is not the right value.
Is there a way to add screenhots directly? Then I could give you some examples showing the respective clients OS version and the output of BPs update history report compared to the output of the remote command.
There you could see that the BP update history correlates fine for all clients running Enterprise-LTSB-14393/LTSC-17736/Professional-18362/18363/19041/19042 and started with strange values at 19043.I found this powershell command on several sites these days and modified it in the way to only show me the date cause I needed something where I could sort for in BP. All other scripts I found have either be to complex or they where not working correctly through all Win10 versions I needed.
August 30, 2021 at 1:05 pm #13044dougModeratorThanks.
Ok so the UBR command I gave you above is still the only other option that I can think that would give you similar (but not identical) info. I don’t have any better options to suggest at the moment.
-
AuthorPosts
- You must be logged in to reply to this topic.