0
Dim Computer, WshNetwork
Set WshNetwork = WScript.CreateObject("WScript.Network")
Computer = WshNetwork.ComputerName
Dim FSO, OutPutFile
Const ForWriting = 2
Const ForAppending = 8
Set FSO = CreateObject("Scripting.FileSystemObject")
Dim EndFile, wsusscn2
EndFile = "c:\Scripts\" & Computer & ".csv" ' choose the location for the output
wsusscn2 = "c:\Scripts\wsusscn2.cab" ' choose location of the cab file
Set OutPutFile = FSO.OpenTextFile(EndFile, ForWriting, True)
Set UpdateSession = CreateObject("Microsoft.Update.Session")
Set UpdateServiceManager = CreateObject("Microsoft.Update.ServiceManager")
Set UpdateService = UpdateServiceManager.AddScanPackageService(_
"Offline Sync Service", wsusscn2)
Set UpdateSearcher = UpdateSession.CreateUpdateSearcher()
UpdateSearcher.ServerSelection = 3 ' ssOthers
UpdateSearcher.ServiceID = UpdateService.ServiceID
Set searchResult = UpdateSearcher.Search("IsInstalled=0")
Set Updates = SearchResult.Updates
OutPutFile.WriteLine "Missing Patches " & Date & Computer
OutPutFile.WriteLine "." OutPutFile.WriteLine "."
If searchResult.Updates.Count = 0 Then
OutPutFile.WriteLine "There are no applicable updates."
WScript.Quit
End If
For I = 0 To searchResult.Updates.Count - 1
Set Update = searchResult.Updates.Item(I)
OutPutFile.WriteLine Update.Title
Next
OutPutFile.Close
WScript.Quit
Josefz嗨,我已經修改,並用管理員權限運行腳本,得到許可被拒絕的錯誤, – Prakaash2109 2015-03-16 05:41:44