当前位置 : 主页 > 大数据 > 区块链 >

powershell – Get-WmiObject:RPC服务器不可用 (HRESULT的异常:0x800706BA)

来源:互联网 收集:自由互联 发布时间:2021-06-22
当我跑 Get-WmiObject win32_SystemEnclosure -Computer hostname | select serialnumber 它适用于本地和远程主机。 当我这样做的主机列表使用 ForEach ($_ in gc u:\pub\list.txt) { Get-WmiObject win32_SystemEnclosure -Compu
当我跑

Get-WmiObject win32_SystemEnclosure -Computer hostname | select serialnumber

它适用于本地和远程主机。

当我这样做的主机列表使用

ForEach ($_ in gc u:\pub\list.txt) {
    Get-WmiObject win32_SystemEnclosure -Computer $_ | select serialnumber | format-table -auto @{Label="Hostname"; Expression={$_}}, @{Label="Service Tag"; Expression={$_.serialnumber}}
}

它返回

Get-WmiObject : The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)

检查每个远程计算机的防火墙中是否启用了“Windows Management Instrumentation(WMI-In)”规则。

或者在管理命令/ Powershell提示符下运行:

netsh advfirewall firewall set rule group="Windows Management Instrumentation (WMI)" new enable=yes
网友评论