In the following code block for the last windows update time, please add a check for BatchPatch as an ApplicationID. We have several Server Core machines that are only updated this way, it doesn't show a last update date.
$searcher = (New-Object -ComObject Microsoft.Update.Session).CreateUpdateSearcher();
$count = $searcher.GetTotalHistoryCount();
$result = 0;
if ($count -gt 0) {
$index = 0;
$maxindex = 100;
if ($count -le 100) {
$maxindex = $count;
}
$history = $searcher.QueryHistory($index, $maxindex);
foreach ($item in $history) {
$clappid = $item.ClientApplicationID
if ($clappid -eq 'CcmExec' -or # SCCM Updater
$clappid -eq 'UpdateOrchestrator' -or # Windows 10+ Updater
$clappid -eq 'AutomaticUpdates' -or # before Windows 10 Updater
$clappid -eq 'AutomaticUpdatesWuApp' # WSUS Updater
) {
if ($item.ResultCode -eq 2) { # 2 = orcSucceeded
$result = $([int64]$($((get-date).ToUniversalTime()) - ($searcher.QueryHistory($index, 1) | Select-Object Date).Date).TotalSeconds);
break;
}
}
$index++;
}
if ($result -eq 0) {
$result = -3; # the last 100 entries didn't contain a successfull windows update
}
} else {
$result = -2; # the history entry collection is empty
}
$result
Article Comments
This will indeed be fixed via 19.x.48, set for release at the end of January. You can download the updated Sensor executable here. Simply place it in the following directory, after backing up the original file:
C:\ | Program Files (x86)\PRTG Network Monitor\Sensor System |
---|
Does the sensor then work as you'd like it to work?
PRTG Scheduler |
PRTGapi |
Feature Requests |
WMI Issues |
SNMP Issues
Kind regards,
Stephan Linke, Tech Support Team
Jan, 2019 - Permalink
Awesome, thanks for the quick revert :) Have a good one!
PRTG Scheduler |
PRTGapi |
Feature Requests |
WMI Issues |
SNMP Issues
Kind regards,
Stephan Linke, Tech Support Team
Jan, 2019 - Permalink
I just wanted to follow up on this. With PRTG 19.1.48.2891, the sensor has been implemented natively. If not already done, I would ask you to install the update as soon as possible. In addition to the bug fixing, additional improvements have been made.
More details can be found at https://www.paessler.com/prtg/history/stable. Most of the changes can be found in version 19.1.48.2868 of February 2nd 2019.
PRTGapi |
Feature Requests |
WMI Issues |
SNMP Issues
Kind regards,
Stephan Linke, Tech Support Team
Feb, 2019 - Permalink
I'll forward this thread to the sensor developer to see what's his take on this is :) Please bear with us, it may take some time until I hear from him.
PRTG Scheduler | PRTGapi | Feature Requests | WMI Issues | SNMP Issues
Kind regards,
Stephan Linke, Tech Support Team
Jan, 2019 - Permalink