WScript.Echo "There are no applicable updates." WScript.Echo I+1 & "> " & B+1 & "> " & UpdateDescription((B)) WScript.Echo I + 1 & "> " & UpdateDescription(update)įor B = 0 to -1 WScript.Echo "List of applicable items found on the machine:"įor I = 0 To -1 Set searchResult = updateSearcher.Search(criteria) WScript.Echo "Searching for updates." & vbCRLF ![]() UpdateSearcher.IncludePotentiallySupersededUpdates = true UpdateSearcher.ServerSelection = serverSelection Set updateSearcher = updateSession.CreateUpdateSearcher() WScript.Echo "Registered offline scan cab, service ID " & serviceId & vbCRLF Set offlineService = updateServiceManager.AddScanPackageService(appName, ("Offline"), 0) Set updateServiceManager = CreateObject("") UpdateSession.ClientApplicationID = appName IgnoreSupersedence = ("IgnoreSupersedence") If ("Criteria") ThenĬriteria = ("Criteria")Ĭriteria = "IsInstalled=0 and Type='Software' and IsHidden=0" InstallationResultToText = "Unexpected (" & result & ")"ĭeploymentActionToText = "None (Inherit)"ĭeploymentActionToText = "Uninstallation"ĭeploymentActionToText = "Optional Installation"ĭeploymentActionToText = "Unexpected (" & action & ")"ĭescription = update.Title & " "ĭescription = description & " Deployment action: " & DeploymentActionToText(update.DeploymentAction) InstallationResultToText = "Succeeded with errors" ' /RebootToComplete: Restart the computer if necessary to completeįunction InstallationResultToText(result) ' /ShowBundle: Output information about the child updates in the ' /ShowDetails: Show details about the updates found by the scan ' /NoInstall: Do not install any updates that the scan detects ' /NoDownload: Do not download any updates that the scan detects ' /Show: Unhide any hidden updates found by the scan. ' normally be installed by Automatic Updates. ' use it, or MU if opted in, or WU otherwise) ' Default: Default service (WSUS if machine is configured to ' Available values: WU, MU, WSUS, DCAT, STORE, or an ' /Service: Update service that script should scan against ' /Offline: Path to WSUSSCN2.cab file that should be used for offline sync ' /IgnoreSupersedence: Display all applicable updates, even those ' /Automate: Don't prompt the user for various actions ' Default: Search for all non-installed, non-hidden software ' IUpdateSearcher::BeginSearch for examples) ' /Criteria: Search criteria to be used (see the WUA documentation for ' this appears in the Windows Update logs ' /AppName: Name to pass to the WUA API as the 'calling application' WScript.Echo "This script is not intended as production code." WScript.Echo "and install updates through the Windows Update Agent API." WScript.Echo "This script is provided by Microsoft Corporation to demonstrate techniques that can be used to search, download," This script is not intended as production code, and the script itself is not supported by Microsoft (though the underlying Windows Update Agent APIs are supported). This script is intended to demonstrate the use of the Windows Update Agent APIs, and provide an example of how developers can use these APIs to solve problems. If the sample is copied to a file named WUA_SearchDownloadInstall.vbs, you can run the sample by opening a Command Prompt window and typing the following command at the command prompt. For more information about WSH, see the WSH section of the Platform Software Development Kit (SDK). Running this sample requires Windows Script Host (WSH). It cannot download updates from a Software Update Services (SUS) 1.0 server. The sample can download updates only by using WUA. For more information about how to determine the version of WUA that is installed, see Determining the Current Version of WUA. If you want to search, download, and install a specific update that you identify by using the update title, see Searching, Downloading, and Installing Specific Updates.īefore you attempt to run this sample, note the following: Finally, it creates a collection of updates to install and then installs them. Next, it creates a collection of updates to download and then downloads them. The sample searches for all the applicable software updates and then lists those updates. The scripting sample in this topic shows you how to use Windows Update Agent (WUA) to scan, download, and install updates.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |