views:

26

answers:

2

Hello,

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

A: 

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.

Stemen
Thanks for the answer. We use WSUS, but i will make a script that check a list of Servers, if there a server that need to patch, i will get a mail. You know what i mean? :-)
matthias
You can get reports and email alerts straight from the WSUS console, no coding required. They're not very configurable, but it is quite easy to see the list of servers that need patches, and which patches they need...
ewall
+2  A: 

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
Tester101
can you explain your code a little bit please?
matthias
@matthias: I added some comments to the code.
Tester101
thanks, thats a good code...
matthias