【问题标题】:WMI Connection to a Windows server on AzureWMI 连接到 Azure 上的 Windows 服务器
【发布时间】:2017-10-09 11:43:32
【问题描述】:

我无法与运行 Windows 操作系统的 Azure 上的任何 VM 建立 WMI 连接。相同的命令在我的 LAN 和 WAN 上运行良好,可以连接到任何 Windows 机器。

例如

Get-WmiObject -Namespace "root\cimv2" -Class Win32_ComputerSystem -Impersonation 3 -ComputerName RemoteWinHost -Credential domain\username  

工作正常,并从“RemoteWinHost”获得所需的信息。但是,当我尝试获取 Azure VM 并给出此错误时,同样失败:

Get-WmiObject : The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)
At line:1 char:1
+ Get-WmiObject -Namespace "root\cimv2" -Class Win32_ComputerSystem -Im ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Get-WmiObject], COMException
    + FullyQualifiedErrorId : GetWMICOMException,Microsoft.PowerShell.Commands.GetWmiObjectCommand

有人可以指导我如何完成与 Azure VM 的 WMI 连接。 VM 不是我的域的一部分,对于凭据,我使用主机名代替域名(主机名\用户名)。也尝试过不附加主机名。结果相同。

【问题讨论】:

    标签: powershell azure wmi remote-access


    【解决方案1】:
    1. 在大多数情况下,它是防火墙。检查它并远程登录端口以确保您可以与它们交谈。我认为端口应该是 TCP/UDP 135。您可以尝试从目标系统内部运行查询以确保这一点。

    2. 您可以尝试的另一件事是Invoke-Command,但它需要 WinRM。

    Invoke-Command -ScriptBlock {Get-WmiObject -Namespace "root\cimv2" -Class Win32_ComputerSystem} -Computer RemoteWinHost -Credential $credentialObject

    1. 您还可以检查目标计算机上的 DCOM 对象。它应该被启用。 https://technet.microsoft.com/en-us/library/cc771387(v=ws.11).aspx

    【讨论】:

      猜你喜欢
      • 2021-09-15
      • 2017-08-02
      • 2016-07-05
      • 1970-01-01
      • 2013-09-17
      • 2021-12-17
      • 2011-06-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多