Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

invoke-command on remote computer using New-Object -ComObject Microsoft.Update.Session

$
0
0

Powershell V2.0 on win2003R2 remoting to 2003R2 and 2008R2

I have a script that I wrote that uses the winupdate api to find updates that need to be applied. the script does a search, followed by a download, followed by install.

if I execute the script locally on any computer, all parts of it work fine, but I can't get it to work on a remote system (eventually a set of systems) from a central server.

I would love to know what I am doing wrong, or how I can make it work another way. I have also tried using a pssession with the same result.

I have narrowed the problem down to this section, if executed locally on serverA, it works, but if executed remotely on the same serverA, it returns the error shown

invoke-command -scriptblock {
  $Session = New-Object -ComObject Microsoft.Update.Session
  $Downloader = $Session.CreateUpdateDownloader()
} -credential $cred -cn $sys

Exception calling "CreateUpdateDownloader" with "0" argument(s): "Access is denied. (Exception from HRESULT: 0x800700
05 (E_ACCESSDENIED))"
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : ComMethodTargetInvocation

thanks for your assistance. Ole Jensen.


Viewing all articles
Browse latest Browse all 6937

Trending Articles