2012-02-02 61 views
0

我试图使用powershell更改远程服务器中的Windows更新设置,但是当我运行下面的命令时,它给了我一个错误。无法在RemotePS会话中使用Windows Update COM对象

PS C:\Windows\system32> Enter-PSSession opalisbinary 

[opalisbinary]: PS C:\Users\superv\Documents> $AUSettings = (New-Object -com "Microsoft.Update.AutoUpdate").Settings 
[opalisbinary]: PS C:\Users\superv\Documents> $AUSettings.NotificationLevel=2 
Property 'NotificationLevel' cannot be found on this object; make sure it exists and is settable. 
At line:1 char:14 
+ $AUSettings. <<<< NotificationLevel=2 
    + CategoryInfo   : InvalidOperation: (NotificationLevel:String) [], RuntimeException 
    + FullyQualifiedErrorId : PropertyNotFound 



[opalisbinary]: PS C:\Users\superv\Documents> $AUSettings.IncludeRecommendedUpdates=$true 


Property 'IncludeRecommendedUpdates' cannot be found on this object; make sure it exists and is settable. 
At line:1 char:14 
+ $AUSettings. <<<< IncludeRecommendedUpdates=$true 
    + CategoryInfo   : InvalidOperation: (IncludeRecommendedUpdates:String) [], RuntimeException 
    + FullyQualifiedErrorId : PropertyNotFound 

[opalisbinary]: PS C:\Users\superv\Documents> $AUSettings.Save() 


You cannot call a method on a null-valued expression. 
At line:1 char:18 
+ $AUSettings.Save <<<<() 
    + CategoryInfo   : InvalidOperation: (Save:String) [], RuntimeException 
    + FullyQualifiedErrorId : InvokeMethodOnNull 

虽然当我在服务器上本地运行它,它工作正常...

任何人都可以请帮助我。

回答

0

当您通过远程桌面连接并运行命令时它工作吗?它也取决于点数。我不知道Microsoft.Update.AutoUpdate,所以我只是猜测,但 - 是否可用于x64版本的PowerShell?换句话说,如果您在x64版本和x86中本地运行它,您是否看到错误?

+0

不,我没有看到任何错误,当我通过RDP访问服务器时运行命令 – PowerShell 2012-02-02 13:57:41

+0

好吧,通过RDP,x86或x64运行哪个版本的PowerShell? – stej 2012-02-02 18:45:28

0

对不起,我找不到真正的答案。我发现的是this link,其中指出远程PS会话可以与SCCM 2012一起使用,但它们不能与SCCM 2007一起使用。

这不会帮助您,但似乎并非所有COM对象都与远程PS会话兼容。