Hello,
i hope you can help me with a registry test. I want to check whether the last Windows Update is not longer than 60 days.
The Registry Key (on Servers) is
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\Results\Install\LastSuccessTime
Sample Result is: "2017-06-17 17:55:15"
In the doku i didn't find a variable for seconds so i'm unsure iof the string can currently parsed successful. I used the following Expression in the field "Alert when Value"
is > than
%yyyy-mm-dd %hh%:%nn%[-60d]%
What am i doing wrong?
Regards
Registry Date parsing
I don't think this is possible unless you create your own shell script to check registry and return # of days to HostMonitor
e.g.
Regards
Alex
e.g.
Code: Select all
'Checks date of last installed Windows update
'====================================================================
'Start cmd: cmd /c cscript /B /E:VBScript %Script% %Params%
'Script requires 1 parameter - number of days threshold.
'====================================================================
'www.ks-soft.net
Option Explicit
const statusOk = "scriptRes:Ok:"
const statusBad = "scriptRes:Bad:"
const statusUnknown = "scriptRes:Unknown:"
Dim oWU, iTHCount, colUpdate, oUpdate, Cnt, k, Dat, objArgs, MDays
Dat = Date
Cnt = 9999999
k = 0
Set objArgs = WScript.Arguments
if objArgs.Count <> 1 then
WScript.StdOut.Write statusUnknown & "Parameter is required: <Max Days Count>"
WScript.Quit
End If
MDays = int(objArgs(0))
On Error Resume Next
Set oWU = CreateObject("Microsoft.Update.Searcher")
If Err.Number <> 0 Then
WScript.StdOut.Write statusUnknown & "WU5 programming interface does not exist.", vbInformation + vbSystemModal, "Update history"
WScript.Quit
End If
On Error Goto 0
iTHCount = oWU.GetTotalHistoryCount
If iTHCount > 0 Then
Set colUpdate = oWU.QueryHistory(0, iTHCount)
For Each oUpdate In colUpdate
if oUpdate.ResultCode = 2 then
k = DateDiff("d",oUpdate.Date,DateValue(Now))
if k<Cnt then
Cnt = k
Dat = oUpdate.Date
End If
End If
Next
if Cnt = 9999999 then
WScript.StdOut.Write statusUnknown & "Windows Updates not found"
else
If Cnt>MDays then
WScript.StdOut.Write statusBad & " Days:" & Cnt & " Last update:" & DateValue(Dat)
else
WScript.StdOut.Write statusOk & " Days:" & Cnt & " Last update:" & DateValue(Dat)
End If
End if
End If
Alex
For security and reliability we always recommend to install RMA agent when you need to check several LANs/domains
http://www.ks-soft.net/hostmon.eng/rma-win/index.htm
Regards
Alex
http://www.ks-soft.net/hostmon.eng/rma-win/index.htm
Regards
Alex