Get-WmiObject win32_operatingsystem not working properly thru Windows XP Firewall
Posted on 2009-04-21
I'm trying to reboot a host remotely using windows powershell. I use
Get-WmiObject win32operatingsystem -computername MyHost
and the error I see:
Get-WmiObject : The RPC server is unavailable. (Exception fom HRESULT:0x800706BA)
I've been able to track down the cause: it's the Windows XP firewall on MyHost. Disabling the firewall makes it work.
So I've been trying to set up the right exception and I'm running into a problem. At minimum I needed to open port 135 TCP. But making this work requires another port to be opened, but that port seems to be changing every time I reboot MyHost. It's in the range of 1090-1160. I established this fact by looking at the firewall logs. When I open the second port it starts to work, but after a reboot, that port changes. I see from netstat and tasklist commands that svchost.exe is listening on that port.
I really want to keep the firewall on.
I realize this is a tough problem. Has anyone seen this and has a work-around?
- a way to specify an exception for multiple ports in the Firewall
- a way to require svchost.exe to use the same port