Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
BoxOpen(apptitle, "Initializing") ; Check for the proper version of the wuaueng.dll file wdll = FileLocate("WUAUENG.DLL") If wdll == "" bmsg(5, "WUAUENG.DLL not found, exiting") Exit EndIf ErrorMode(@OFF) dllver = FileVerInfo(wdll, "", "ProductVersion") ErrorMode(@CANCEL) reqdllver = "5.8.0.2339" If dllver < reqdllver bmsg(5, "Windows Update client version is less than required") Exit EndIf BoxOpen(Apptitle, "Initializing") ; Set the Automatic Updates Service to Automatic. ErrorMode(@OFF) svcset = wntSvcCfgSet("", "wuauserv", 1000, 1, 2) ErrorMode(@CANCEL) If svcset == 0 Then bmsg(5, "ERROR - Could not configure Automatic Updates services to start automatically") Goto WBERRORHANDLER EndIf updateSession = CreateObject("Microsoft.Update.Session") updateSearcher = updateSession.CreateupdateSearcher() searchResult = updateSearcher.Search("IsInstalled=0 and Type='Software'") BoxText("Searching for updates...") srslt = searchResult.Updates.Count -1 If searchResult.Updates.Count <= 0 bmsg(4, "There are no applicable updates, exiting") Exit End If For I = 0 To srslt update = searchResult.Updates.Item(I) BoxText(StrCat(I + 1 , "> " , update.Title)) Next BoxText( "Creating collection of updates to download:") updatesToDownload = CreateObject("Microsoft.Update.UpdateColl") For I = 0 To srslt update = searchResult.Updates.Item(I) BoxText(StrCat(I, "> adding: " , update.Title)) updatesToDownload.Add(update) Next BoxText("Downloading updates...") downloader = updateSession.CreateUpdateDownloader() downloader.Updates = updatesToDownload downloader.Download() BoxText("List of downloaded updates:") For I = 0 To srslt update = searchResult.Updates.Item(I) If update.IsDownloaded Then BoxText(StrCat(I + 1 , "> " , update.Title )) End If Next updatesToInstall = CreateObject("Microsoft.Update.UpdateColl") BoxText("Creating collection of downloaded updates to install:") For I = 0 To srslt update = searchResult.Updates.Item(I) If update.IsDownloaded Then BoxText(StrCat(I + 1 , "> adding: " , update.Title, updatesToInstall.Add(update))) End If Next BoxText("Installing updates...") installer = updateSession.CreateUpdateInstaller() installer.Updates = updatesToInstall installationResult = installer.Install() ; 'Output results of install BoxText(StrCat("Installation Result: " , installationResult.ResultCode ) BoxText(StrCat("Reboot Required: " , installationResult.RebootRequired ) BoxText(StrCat("Listing of updates installed and individual installation results:") For I = 0 To updatesToInstall.Count - 1 BoxText(StrCat(I + 1 , "> " , updatesToInstall.Item(i).Title , ": " , installationResult.GetUpdateResult(i).ResultCode) Next
Article ID: W17433
File Created: 2008:04:10:15:10:22
Last Updated: 2008:04:10:15:10:22