Windows updates
-
-
Hi,
it's time of last system update detection, download, and installation as UNIX time (seconds since epoch).
Best regards,
Victor -
-
-
-
-
Make a shellexec to cmd.
Use grep for windows and look in C:\windows\windowsupdate.logIf are you using windows 10:
Windows Update logs are now generated using ETW (Event Tracing for Windows).
Please run the Get-WindowsUpdateLog PowerShell command to convert ETW traces into a readable WindowsUpdate.log.
For more information, please visit http://go.microsoft.com/fwlink/?LinkId=518345 -
-
-
-
I am guessing that the System.Update.LastInstallTime is based on reading the Windows Update registry value, which Microsoft removed with Windows 10 and Server 2016, i.e. it won't work anymore.
The following PowerShell gives you the date of the last successful Windows Update installation (works for me, but knowing when my system last installed updates, the time appears to be in UTC):
$updateSearch = (New-Object -ComObject Microsoft.Update.Session ).CreateUpdateSearcher() ($updateSearch.QueryHistory(0,$updateSearch.GetTotalHistoryCount())| ?{$_.ResultCode -eq 2}|Sort-Object -Property Date -Descending).Date|Select -First 1For some more background into, quoting "https://stackoverflow.com/questions/33732541/powershell-how-to-get-date-of-last-windows-update-install-or-at-least-checked-f":
$Session = New-Object -ComObject Microsoft.Update.Session $Searcher = $Session.CreateUpdateSearcher() $HistoryCount = $Searcher.GetTotalHistoryCount() # http://msdn.microsoft.com/en-us/library/windows/desktop/aa386532%28v=vs.85%29.aspx $Searcher.QueryHistory(0,$HistoryCount) | ForEach-Object {$_}This will list all updates which the system tried to install, including a timestamp (which on my system appears to be UTC) and a result code.
Those translate to:0 = Not Started 1 = In Progress 2 = Succeeded 3 = Succeeded With Errrors 4 = Failed 5 = AbortedIf a patch failed to install several times, it is supposedly listed several times as well. I cannot confirm that, as I have no failed patches in my list.
It also appears that the large cumulative updates like the Creators Update resets the contents of the list. Mine only goes back to said Creators Update.
Either way, with a bit of scripting you can return a few more things, like the number of unique patches which have failed to install.I am not sure if the status 0 could be used to determine how many patches the system knows about that are not installed yet.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login