블로그 이미지
LifeisSimple

calendar

1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30

Notice

2010. 8. 22. 19:24 Brain Trainning/DataBase
Using WUA to Scan for Updates Offline

Windows Update Agent (WUA) can be used to scan computers for security updates without connecting to Windows Update or to a Windows Server Update Services (WSUS) server, which enables computers that are not connected to the Internet to be scanned for security updates.

Offline scanning for updates requires the download of a signed file, WsusScan.cab, from Windows Update. Offline scanning for security updates that use Windows Installer require that Windows Installer 3.1 be installed on the computer.

The WsusScan.cab file is a cabinet file that is signed by Microsoft. This file contains security updates. Computers that are not connected to the Internet can be scanned and then updated for the updates in the WsusScan.cab file.

The WsusScan.cab file contains the security updates, update rollups, and service packs that are available from Microsoft Update. The WsusScan.cab file is automatically updated when a security update, update rollup, or service pack is added, removed, or revised on the Microsoft Updates site. The latest WsusScan.cab is available for download at the following location: Download WsusScan.cab

After you download the latest WsusScan.cab, the file can be provided to the AddScanPackageService method, and the WUA API can be used to search the offline computer for security updates. WUA validates that the WsusScan.cab is signed by a valid Microsoft certificate before running an offline scan.

Windows Installer version 3.1 must be installed to search for security updates that use Windows Installer technology. If Windows Installer version 3.1 is not installed, WUA may not return the entire set of updates that are applicable to an offline computer system.

Example

The following example uses the WsusScan.cab file to scan a computer and displays updates that are missing.

Set UpdateSession = CreateObject("Microsoft.Update.Session")
Set UpdateServiceManager = CreateObject("Microsoft.Update.ServiceManager")
Set UpdateService = UpdateServiceManager.AddScanPackageService("Offline Sync Service", "c:\wsusscan.cab")
Set UpdateSearcher = UpdateSession.CreateUpdateSearcher()

WScript.Echo "Searching for updates..." & vbCRLF

UpdateSearcher.ServerSelection = 3 ' ssOthers

UpdateSearcher.ServiceID = UpdateService.ServiceID

Set SearchResult = UpdateSearcher.Search("IsInstalled=0")

Set Updates = SearchResult.Updates

If searchResult.Updates.Count = 0 Then
    WScript.Echo "There are no applicable updates."
    WScript.Quit
End If

WScript.Echo "List of applicable items on the machine when using wssuscan.cab:" & vbCRLF

For I = 0 to searchResult.Updates.Count-1
    Set update = searchResult.Updates.Item(I)
    WScript.Echo I + 1 & "> " & update.Title
Next

WScript.Quit

<출처> MSDN
posted by LifeisSimple