Print View

Microsoft.Update.Session scripted Windows Update fails with .ResultCode=4 (Failure)

Issue

When running the script to deploy Windows Updates using the Microsoft.Update.Session/Microsoft.Update.UpdateColl object, an update may fail to install with ResultCode 4, which is "Failure".

Searching, Downloading, and Installing Updates
http://msdn.microsoft.com/en-us/library/aa387102.aspx

e.g.

Searching for updates...

List of applicable items on the machine:
1> Windows Malicious Software Removal Tool x64 - June 2009 (KB890830)

Creating collection of updates to download:
1> adding: Windows Malicious Software Removal Tool x64 - June 2009 (KB890830)

Downloading updates...

List of downloaded updates:
1> Windows Malicious Software Removal Tool x64 - June 2009 (KB890830)

Creating collection of downloaded updates to install:
1> adding: Windows Malicious Software Removal Tool x64 - June 2009 (KB890830)
Installing updates...
Installation Result: Failed
Reboot Required: False

Listing of updates installed and individual installation results:
1> Windows Malicious Software Removal Tool x64 - June 2009 (KB890830): Failed

Resolution

The End User License Agreement needs to be accepted for some updates. This can be done in the script:

WScript.Echo vbCRLF & "Creating collection of updates to download:"
Set updatesToDownload = CreateObject("Microsoft.Update.UpdateColl")
For I = 0 to searchResult.Updates.Count-1
    Set update = searchResult.Updates.Item(I)
    WScript.Echo I + 1 & "> adding: " & update.Title 
    updatesToDownload.Add(update)
    If update.EulaAccepted = False Then 
        update.AcceptEula
        WScript.Echo I + 1 & ">     Accept EULA " & update.Title 
    End If
Next

Products

Microsoft Windows Update Agent 7.2.6001.788

Created: 18th June 2009
Updated: 18th June 2009

Print View

© 2005-2024 Jamie Morrison