This is the situation:
I work on a workstation (Windows 7) and want to perform an action on a server (Server 2008 R2).
The workstation is called MyWks01 and the server is called MyServer01.
Both machines are members of the same domain and I am logged on with domain admin credentials on the workstation.
UAC is disabled on the server.
I have a command prompt open as administrator and open a Powershell session.
The final aim is to perform Windows updates by executing a scriptblock remotely.
To test part of the solutiopn I perform following action:
-----------------------------------
RemoteServer = New-PSSession -ComputerName MyServer01
$Script = {
$session = New-Object -ComObject Microsoft.Update.Session
$Downloader = $session.CreateUpdateDownLoader()
}
Invoke-Command -Session $RemoteServer -ScriptBlock $Script
-----------------------------------
This gives following error:
-----------------------------------
Exception calling "CreateUpdateDownloader" with "0" argument(s): "Access is
denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))"
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : ComMethodTargetInvocation
+ PSComputerName : MyServer01
-----------------------------------
If I replace $script with the following block:
$Script = {Get-ChildItem c:\Temp}
then everything works correctly (I get a list of files in the c:\Temp directory of the server)
Apparently it is the CreateUpdateDownloader() that poses a particuar problem, anyone any ideas?
BTW: CreateUpdateInstaller() has the same problem, on the other hand Windows.UpdateSearcher with the Search("IsAssigned=1" and IsInstalled=0) methods does work.