Fix installing updates that were downloaded by Windows but not selected in the script

This commit is contained in:
Fierelier 2021-11-13 20:33:53 +01:00
parent e1b4c84856
commit bbc3416508
1 changed files with 3 additions and 5 deletions

View File

@ -46,10 +46,8 @@ For I = 0 to userUpdatesToApply.Count-1
addThisUpdate = false
If update.EulaAccepted = false Then
update.AcceptEula()
addThisUpdate = true
Else
addThisUpdate = true
End If
addThisUpdate = true
If addThisUpdate = true Then
WScript.Echo I + 1 & "> adding: " & update.Title
@ -69,8 +67,8 @@ downloader.Download()
Set updatesToInstall = CreateObject("Microsoft.Update.UpdateColl")
rebootMayBeRequired = false
WScript.Echo vbCRLF & "Successfully downloaded updates:"
For I = 0 To searchResult.Updates.Count-1
set update = searchResult.Updates.Item(I)
For I = 0 To userUpdatesToApply.Count-1
set update = searchResult.Updates.Item(userUpdatesToApply.Item(I))
If update.IsDownloaded = true Then
WScript.Echo I + 1 & "> " & update.Title
updatesToInstall.Add(update)