Windows Update Check with vbscript
has someone a script/or can help me to check, is there a windows update for a server available?
So i will get a mail when the yellow update icon is in the taskbar.
My idea is: Send a mail, if the wuauclt.exe longer than 10 minutes in the taskbar.
But i have no idea to make this.
I found only this:
Dim strComputer, strProcess
Do
strProcess = inputbox( "Please enter the name of the process (for instance:开发者_如何学Python explorer.exe)", "Input" )
Loop until strProcess <> ""
Do
strComputer = inputbox( "Please enter the computer name", "Input" )
Loop until strComputer <> ""
If( IsProcessRunning( strComputer, strProcess ) = True ) Then
WScript.Echo "Process " & strProcess & " is running on computer " & strComputer
Else
WScript.Echo "Process " & strProcess & " is NOT running on computer " & strComputer
End If
Thanks for help.
How about something like this
'Microsoft magic
Set updateSession = CreateObject("Microsoft.Update.Session")
Set updateSearcher = updateSession.CreateupdateSearcher()
Set searchResult = updateSearcher.Search("IsInstalled=0 and Type='Software'")
'End Microsoft magic
If searchResult.Updates.Count <> 0 Then 'If updates were found
'This is where you add your code to send an E-Mail.
'Send E-mail including a list of updates needed.
'This is how you can list the title of each update that was found.
'You could include the list in the body of your E-Mail.
For i = 0 To searchResult.Updates.Count - 1
Set update = searchResult.Updates.Item(i)
WScript.Echo update.Title
Next
End If
wuauclt could quite possibly be running for more than 10 minutes, without necessarily be notifying the user that there are pending updates.
I know that this is StackOverflow, and this is a programming question, but I'm a sysadmin, and I'm of the opinion that this belongs on ServerFault, and that you're doing it wrong. WSUS (http://technet.microsoft.com/en-us/wsus/default.aspx) is designed to manage Windows Updates.
精彩评论