When I run
Get-WmiObject win32_SystemEnclosure -Computer hostname | select serialnumber
it works for both local and remote hosts.
W
I found this blog post which suggested adding a firewall exception for "Remote Administration", and that worked for us on our Windows Server 2008 Enterprise systems.
http://mikefrobbins.com/2012/03/08/get-wmiobject-the-rpc-server-is-unavailable-exception-from-hresult-0x800706ba/
I was doing this mistake
ForEach ($server in $servers) {
$OS = Get-WmiObject win32_operatingsystem -ComputerName $server
}
Which, of course, couldn't be passed, because output of the server in a csv file was @{Name=hv1g.contoso.com}
I had to call the property from csv file like this $server.Name
ForEach ($server in $servers) {
$OS = Get-WmiObject win32_operatingsystem -ComputerName $server.Name
}
It fixed my issue.
It might be due to various issues.I cant say which one is there in your case.
Below given reasons may be there:
Some WMI related services are as given:
For DCOM setting refer:
HKLM\Software\Microsoft\OLE
, Value: EnableDCOM
The value should be set to 'Y' .
Below is the native PowerShell command for the most up-voted solution. Instead of: netsh advfirewall firewall set rule group="Windows Management Instrumentation (WMI)" new enable=yes
Use could use the slightly simpler syntax of:
Enable-NetFirewallRule -DisplayGroup "Windows Management Instrumentation (WMI-In)"
Turning the firewall off resolved it for me.
If you've tried some of the suggestions in the other answers, most notably:
Windows Management Instrumentation (WMI)
inbound firewall rule is enabled Then consider other common reasons for getting this error: