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

前端 未结 16 2010
失恋的感觉
失恋的感觉 2020-12-08 13:32

When I run

Get-WmiObject win32_SystemEnclosure -Computer hostname | select serialnumber

it works for both local and remote hosts.

W

16条回答
  •  暖寄归人
    2020-12-08 14:11

    Solved.

    I was running into the exact same error message when trying to execute the following script (partial) against a remote VM that was configured to be in the WORKGROUP.

    Restart-Computer -ComputerName MyComputer -Authentication Default -Credential $cred -force
    

    I noticed I could run the script from another VM in the same WORKGROUP when I disabled the firewall but still couldn't do it from a machine on the domain. Those two things along with Stackflow suggestions is what brought me to the following solution:

    Note: Change these settings at your own risk. You should understand the security implications of these changes before applying them.

    On the remote machine:

    • Make sure you re-enable your Firewall if you've disabled it during testing.
    • Run Enable-PSRemoting from PowerShell with success
    • Go into wf.msc (Windows Firewall with Advanced Security)
    • Confirm the Private/Public inbound 'Windows Management Instrumentation (DCOM-In)' rule is enabled AND make sure the 'Remote Address' property is 'Any' or something more secure.
    • Confirm the Private/Public inbound 'Windows Management Instrumentation (WMI-In)' rule is enabled AND make sure the 'Remote Address' property is 'Any' or something more secure.

    Optional: You may also need to perform the following if you want to run commands like 'Enter-PSSession'.

    • Confirm the Private/Public inbound 'Windows Management Instrumentation (ASync-In)' rule is enabled AND make sure the 'Remote Address' property is 'Any' or something more secure.
    • Open up an Inbound TCP port to 5985

    IMPORTANT! - It's taking my remote VM about 2 minutes or so after it reboots to respond to the 'Enter-PSSession' command even though other networking services are starting up without problems. Give it a couple minutes and then try.

    Side Note: Before I changed the 'Remote Address' property to 'Any', both of the rules were set to 'Local subnet'.

提交回复
热议问题