|
View previous topic :: View next topic |
Author |
Message |
chri
Joined: 09 Mar 2009 Posts: 19
|
Posted: Wed Jun 25, 2014 12:26 am Post subject: |
|
|
we made a Little modification and we now get "how many days are gone since the Server has installed the last updates"
start cmd: cmd /c cscript /B /E:VBScript %Script% %Params%
Parameter: "ServerName" xx (in days before alert)
script:
Option Explicit
On Error Resume Next
const statusAlive = "scriptRes:Host is alive:"
const statusDead = "scriptRes:No answer:"
const statusUnknown = "scriptRes:Unknown:"
const statusNotResolved = "scriptRes:Unknown host:"
const statusOk = "scriptRes:Ok:"
const statusBad = "scriptRes:Bad:"
const statusBadContents = "scriptRes:Bad contents:"
dim updateSession, updateSearcher, searchResult, objArgs
Set objArgs = WScript.Arguments
checkForError(1)
if objArgs.Count=0 Then
Set updateSession = CreateObject("Microsoft.Update.Session")
else
Set updateSession = CreateObject("Microsoft.Update.Session",objArgs(0))
end if
checkForError(2)
Set updateSearcher = updateSession.CreateupdateSearcher()
checkForError(3)
Set searchResult = updateSearcher.QueryHistory(1,1)
checkForError(4)
if searchResult.Count>0 then
' wscript.echo int(datediff("d", searchresult.item(0).date,now))
if int(datediff("d", searchresult.item(0).date,now)) > int(objArgs(1)) then
wscript.stdout.write statusBad & datediff("d", searchresult.item(0).date,now)
else
wscript.stdout.write statusOk & datediff("d", searchresult.item(0).date,now)
end if
else
WScript.StdOut.Write statusBad & "No updates installed."
End If
Sub checkForError(txt)
If Err.Number <> 0 Then
WScript.StdOut.Write statusUnknown & "(" & txt & ") " &Err.Description
WScript.Quit
End If
End Sub |
|
Back to top |
|
|
KS-Soft Europe
Joined: 16 May 2006 Posts: 2832
|
Posted: Wed Jun 25, 2014 1:22 am Post subject: |
|
|
Thank you for sharing. |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|