Wednesday, April 17, 2013

Allow Remote WMI connection in Windows Servers 2008 R2

I wanna a C# program to get disk space of a remote server whose OS is Windows Server 2008 R2. The program and the server are under different domains. I use server's domain account to authenticate the connection. 

Unluckily, the most different part of this task is the configuration of enabling remote WMI connection, not the program to get a disk space. Two error codes:  

=> The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)  
=> Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))  

I have spent much time on the first one and it seems there are some thing wrong with my config. Here are some steps I still remember:

1. Allow WMI to communicate through firewall



2. Enable "remote launch" and "remote activation" in Access Permission of Component Services



3. Enable "remote access" in Access Permission of Component Services



4. Enable "remote enable" in WMI Control Properties



You can simply test WMI connection by using wmic command
wmic /node:localhost /user:administrator /password:1234 bios get serialnumber 

No comments:

Post a Comment