Powershell 无法在RemotePS会话中使用Windows Update COM对象
我正在尝试使用powershell更改远程服务器中的windows update设置,但当我运行以下命令时,会出现错误Powershell 无法在RemotePS会话中使用Windows Update COM对象,powershell,powershell-remoting,Powershell,Powershell Remoting,我正在尝试使用powershell更改远程服务器中的windows update设置,但当我运行以下命令时,会出现错误 PS C:\Windows\system32> Enter-PSSession opalisbinary [opalisbinary]: PS C:\Users\superv\Documents> $AUSettings = (New-Object -com "Microsoft.Update.AutoUpdate").Settings [opalisbinary
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
PS C:\Windows\system32>输入PSSession opalisbinary
[opalisbinary]:PS C:\Users\superv\Documents>$AUSettings=(新对象-com“Microsoft.Update.AutoUpdate”).Settings
[opalisbinary]:PS C:\Users\superv\Documents>$AUSettings.NotificationLevel=2
在此对象上找不到属性“NotificationLevel”;确保它存在并且可设置。
第1行字符:14
+澳元 当您通过远程桌面连接并运行命令时,它是否工作?这也取决于比特数。我不知道Microsoft.Update.AutoUpdate,所以我只是猜测,但是-它是否适用于x64版本的PowerShell?换句话说,如果您在x64版本和x86中本地运行它,您看到错误了吗?很抱歉,我找不到真正的答案。我发现的是,远程PS会话可以用于SCCM 2012,但不能用于SCCM 2007
这对您没有帮助,但似乎并非所有COM对象都与远程PS会话兼容。否我在通过RDPOk访问服务器时运行命令时未发现任何错误,您通过RDP、x86或x64运行的PowerShell版本是什么?