locked
Remotely invoking windows update installation RRS feed

  • Question

  • Hello Team,

    We are planning to install windows updates which is already downloaded from WSUS and waiting to install via a Powershell script remotely.

    we have tried multiple options to invoke the install from remote machine , however this has failed on all attempts. Please help us to find our a solution for this.

    we are getting below exception when trying to invoke from powershell remotely .

             Initialising and Checking for Applicable Updates. Please wait ...
             Preparing List of Applicable Updates For This Computer ...
             Initialising Download of Applicable Updates ...
             Starting Installation of Downloaded Updates ...

    IsPublic IsSerial Name                                     BaseType
    -------- -------- ----                                     --------
    True     True     Exception                                System.Object
    True     True     Exception                                System.Object
    True     True     Exception                                System.Object
    True     True     Exception                                System.Object
    True     True     Exception                                System.Object
    True     True     Exception                                System.Object
    True     True     Exception                                System.Object
    True     True     Exception                                System.Object
    True     True     Exception                                System.Object
    True     True     Exception                                System.Object
    True     True     Exception                                System.Object
    True     True     Exception                                System.Object
    True     True     Exception                                System.Object
    True     True     Exception                                System.Object
    True     True     Exception                                System.Object
    True     True     Exception                                System.Object
    True     True     Exception                                System.Object
    True     True     Exception                                System.Object
    True     True     Exception                                System.Object
    True     True     Exception                                System.Object
    True     True     Exception                                System.Object
    True     True     Exception                                System.Object
    True     True     Exception                                System.Object
    True     True     Exception                                System.Object
    True     True     Exception                                System.Object
    True     True     Exception                                System.Object

    Powershell Transcript 

    PS>TerminatingError(New-Object): "Creating an instance of the COM component with CLSID {D2E0FE7F-D23E-48E1-93C0-6FA8CC346474} from the IClassFactory failed due to the following error: 80070005 Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))."

    Script Used: 

    https://gallery.technet.microsoft.com/scriptcenter/Execute-Windows-Update-fc6acb16/view/Discussions#content

    Thanks,

    Jijo John

    Thursday, January 31, 2019 2:23 PM

All replies

  • If you have questions or problems with gallery scripts you should contact the author for help. Use the link you posted.

    Live long and prosper!

    (79,108,97,102|%{[char]$_})-join''

    Thursday, January 31, 2019 2:30 PM
  • Updates cannot be directly installed remotely. 

    \_(ツ)_/

    Thursday, January 31, 2019 4:34 PM
  • now you are able to run this Code on a remote machine using the cmdlet invoke-command.

    Or if you want to install updates on multiple machine parallel use start-Job in order to execute the above PowerShell Code.


    regards Thomas Paetzold visit my blog on: http://sus42.wordpress.com

    If you fix your code and test it you will find that updates cannot be installed in a remote session. This is well documented and has been for years.

    Example:

    PS C:\scripts> $sb = {
    >>     $session = New-Object -ComObject Microsoft.Update.Session
    >>     $updates = $session.CreateupdateSearcher().Search('IsInstalled=0 and IsHidden=0').Updates
    >>     $updatesToInstall = New-object -ComObject Microsoft.Update.UpdateColl
    >>     $Updates | Where-Object { $_.isdownloaded } |
    >>         foreach-Object { $updatesToInstall.Add($_) | out-null }
    >>
    >>     $installer = $session.CreateUpdateInstaller()
    >>     $installer.Updates = $updatesToInstall
    >> }
    PS C:\scripts> Invoke-Command -ComputerName WS701 -ScriptBlock $sb
    Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
        + CategoryInfo          : OperationStopped: (:) [], UnauthorizedAccessException
        + FullyQualifiedErrorId : System.UnauthorizedAccessException
        + PSComputerName        : WS701


    \_(ツ)_/


    • Edited by jrv Friday, February 1, 2019 5:49 PM
    Friday, February 1, 2019 5:48 PM