无法在RemotePS会话中使用Windows Update COM对象

时间:2012-02-02 12:01:09

标签: powershell powershell-remoting

我尝试使用PowerShell更改远程服务器中的Windows更新设置,但是当我运行以下命令时,它会给我一个错误。

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

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

有人可以帮助我。

2 个答案:

答案 0 :(得分:0)

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

答案 1 :(得分:0)

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

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