Powershell - 调用远程 WMI 对象 - RPC 错误 HRESULT:0x800706BA(RPC 服务器不可用)

发布于 2024-07-24 20:58:40 字数 931 浏览 14 评论 0原文

我在 Get-WmiObject 和该对象的使用方面遇到了一些麻烦。

以防万一,我正在连接到远程计算机 - 该计算机不在 AD 中,而是在互联网中。

我正在使用凭据,并且能够通过命令检索 WMI 类或对象的列表(具体来说,我想使用 Win32_Process):

$credential = Get-Credential
$class = Get-WmiObject -list -computer "xyz" -credential $credential | Where-Object {$_.Name -eq "Win32_Process" }
$object = Get-WmiObject -class Win32_Process -computer "xyz" -credential $credential

当我更改主机名或凭据时,我收到错误“RPC”不可用”或未经授权的访问。 因此我假设 RPC 服务器和 WMI 对象的检索以及 类作品。

但是当我检索它们时,我无法使用它们。 在任何尝试它(调用方法或 Get-Member)的情况下,它都会抛出此错误:

"Server RPC není k dispozici. (Výjimka na základě hodnoty HRESULT: 0x800706BA)"
(It's a czech localization of: Server RPC is not available. (Exception based on the value of HRESULT: 0x800706BA)

我还没有找到类似错误的任何其他示例。 我在 Vista Ent 上使用 PowerShell 1.0。 机器。 目标机器是Win2003 R2(产品服务器将是Win.Serv.2008 - 尚未测试)。

我将不胜感激任何建议。 谢谢。

I've got some troubles with Get-WmiObject and usage of this object.

In case, I'm connecting to remote computer - which is not in AD, but in the internet.

I'm using credentials and I'm able to retrieve list of WMI classes, or object (to be specific, I want to work with Win32_Process) via commands:

$credential = Get-Credential
$class = Get-WmiObject -list -computer "xyz" -credential $credential | Where-Object {$_.Name -eq "Win32_Process" }
$object = Get-WmiObject -class Win32_Process -computer "xyz" -credential $credential

When I change the hostname or credentials, then I got and error of "RPC not available", or unauthorized access. Therefore I assume, that RPC server and retrieving of WMI objects & classes works.

But when I retrieve them, I'm not able to work with them. In any case of trying it (calling method, or Get-Member) it's throwing this error:

"Server RPC není k dispozici. (Výjimka na základě hodnoty HRESULT: 0x800706BA)"
(It's a czech localization of: Server RPC is not available. (Exception based on the value of HRESULT: 0x800706BA)

I haven't found any other example of similar error. I'm using PowerShell 1.0 on Vista Ent. machine. Target machine is Win2003 R2 (Product server will be Win. Serv. 2008 - not tested yet).

I would appreciate any advice. Thank you.

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

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

发布评论

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

评论(1

不必了 2024-07-31 20:58:40

我收到错误“RPC 不可用”或未经授权的访问。 因此我假设 RPC 服务器和 WMI 对象的检索以及 类有效。

不幸的是,这不是一个安全的假设。
如果您尝试通过 WMI 连接到不存在的计算机上的名称空间,例如 foo ("\foo\root\cimv2"),您将得到该错误:

0x800706BA ("The RPC server is unavailable.")

另外:

我正在连接到远程计算机 - 不在 AD 中,而是在互联网中。

请注意,互联网上的 WMI 将很难发挥作用。
即使您可以 ping 通目标计算机,也不意味着您能够通过 WMI 连接到它。 DCOM 使用大量端口,防火墙、NAT 路由器等会乐意阻止这些端口。 如果您的完全相同的呼叫适用于本地主机但不适用于互联网,那么您就会遇到问题。

如果您控制防火墙,则可以考虑限制 DCOM 使用的端口,然后打开这些端口。
如果您只是使用野生互联网,也许您可​​能想考虑设置 VPN,我认为这应该可以消除“互联网”问题?

I got and error of "RPC not available", or unauthorized access. Therefore I assume, that RPC server and retrieving of WMI objects & classes works.

Unfortunately that's not a safe assumption.
If you try to connect via WMI to a namespace on non-existent machine, e.g. foo ("\foo\root\cimv2"), you'll get exactly that error:

0x800706BA ("The RPC server is unavailable.")

In addition:

I'm connecting to remote computer - which is not in AD, but in the internet.

Note that WMI over the internet is going to be hard to get working.
Even if you can ping the target machine, that does not mean you'll be able to connect to it via WMI. DCOM uses a bunch of ports that firewall, NAT routers, etc. will happily block. If your exact same calls work for a local host but not over the internet, you've got a problem.

If you control the firewalls, you can look into restricting the ports that DCOM uses, and then opening up those ports.
If you're just using the wild internet, perhaps you might want to look into setting up a VPN, which I think should eliminate the 'Internet' issue?

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