Windows Update检查vbscript

时间:2010-07-05 13:38:13

标签: windows vbscript process

有人有脚本/或者可以帮我查一下,是否有服务器的Windows更新?

当黄色更新图标出现在任务栏中时,我会收到一封邮件。

我的想法是:如果wuauclt.exe在任务栏中超过10分钟,则发送邮件。

但我不知道这个。

我发现只有这个:

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

感谢您的帮助。

2 个答案:

答案 0 :(得分:5)

这样的事情

'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

答案 1 :(得分:0)

wuauclt很可能运行超过10分钟,而不必通知用户有待处理的更新。

我知道这是StackOverflow,这是一个编程问题,但我是一个系统管理员,而且我认为这属于ServerFault,并且你做错了。 WSUS(http://technet.microsoft.com/en-us/wsus/default.aspx)旨在管理Windows更新。