$UpdateSession = ObjCreate("Microsoft.Update.Session")
$UpdateServiceManager = ObjCreate("Microsoft.Update.ServiceManager")
$UpdateService = $UpdateServiceManager.AddScanPackageService("Offline", "d:\wsusscan.cab")
$UpdateSearcher = $UpdateSession.CreateUpdateSearcher()
MsgBox(0,"提示","正在搜索升级!")
$UpdateSearcher.ServerSelection = 3
$UpdateSearcher.ServiceID = $UpdateService.ServiceID
$SearchResult = $UpdateSearcher.Search("IsInstalled=0")
$Updates = $SearchResult.Updates
If $searchResult.Updates.Count = 0 Then
MsgBox(0,"提示","没用搜索到升级!")
Exit
EndIf
For $I = 0 to $searchResult.Updates.Count-1
$update = $searchResult.Updates.Item($I)
MsgBox(0,$I + 1,$update.Title)
Next
|