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

发布于 2025-01-01 12:20:30 字数 1469 浏览 1 评论 0原文

我尝试使用 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

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

任何人都可以帮助我。

Im trying to change the windows update settings in a remote server using powershell, but when i run the below commands it gives me an error.

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

Although when i run it locally on the server it works fine...

Could anyone please help me.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

揽清风入怀 2025-01-08 12:20:30

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

Does it work when you connect via Remote desktop and run the commands? It also depends on the bittnes. I don't know the Microsoft.Update.AutoUpdate, so I'm just guessing, but - is it available for x64 version of PowerShell? In other words if you run it locally in x64 version and x86, do you see the errors?

一向肩并 2025-01-08 12:20:30

抱歉,我找不到真正的答案。我发现的是 此链接指出远程 PS 会话可以与 SCCM 2012 一起使用,但不能与 SCCM 2007 一起使用

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

I am sorry, I could not find a real answer. What I found is this link which states that remote PS sessions can be used with SCCM 2012, but they could not with SCCM 2007.

This does not help you, but it seems that not all COM objects are compatible with remote PS sessions.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文