Windows updates

Started by dersonik, April 19, 2016, 11:28:15 AM

Previous topic - Next topic

dersonik

what this details means:


System update: last detect time = 1461028113
System update: last download time = 1460658737
System update: last install time = 1460630098


Windows server 2012

Victor Kirhenshtein

Hi,

it's time of last system update detection, download, and installation as UNIX time (seconds since epoch).

Best regards,
Victor

JRH

Hi dersonik

Run this in your transformation properties and it will return you the date and time from the unix time provided by the poll.

strftime("%Y-%m-%d %H:%M", $1)

Cheers

dersonik


JRH

no Problem

I had to figure out the hard way :)

dersonik

any tips how grab the numbers of update to download?

jhonnyvey

Make a shellexec to cmd.
Use grep for windows and look in C:\windows\windowsupdate.log

If 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

rainerh

I have a Windows Server 2016 but this DCI will not work: System.Update.LastInstallTime
Error: Cannot get current parameter value: Communication failure

Akira

#8
2.0.8 still not working on 2016

rainerh

With new Version nxagent-2.1-RC1-x64 I will have the same error:
Cannot get current parameter value: Operation cannot be completed due to agent error

Tursiops

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 1


For 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 = Aborted


If 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.