How to Access WMI From Server 2008 to Windows XP.?

Dec 27 2008 3:13 AM
Hi All,

I am trying to test the success of WMI to check connectivity to a remote computer:
I have 2 computers:A,B Computer A: Windows Server 2008.Computer B: Windows XP SP2.They are all on the same network (a workgroup, not domain), with no firewalls in between (excepting Windows Firewall, which I have disabled on Computer B)

i wrote the following code.if local system means that code is working fine.Remotely means it show on Access Denied Error.How to Access WMI From Server 2008 to Windows XP.That remote connection Windows xp to Server 2008 Success.but Server 2008 to Windows Xp show on error like that access denied. Can Anyone help me?
Any help would be appreciated.

ConnectionOptions connection = new ConnectionOptions();
connection.EnablePrivileges = true;
ManagementScope scope = null;

//connection.Authority = "NTLMDomain:" + domain;
//connection.Username = userName;
//connection.Password = password;

//Local Machine

if (compName.ToUpper() == Environment.MachineName.ToUpper())
{
scope = new ManagementScope(@"\root\cimv2", connection);
}
else //Remote Machine
{
scope = new ManagementScope(@"\\" + compName + @"\root\cimv2", connection);
}

scope.Options.EnablePrivileges = true;
scope.Connect();

//

ObjectQuery query = new ObjectQuery("SELECT * FROM Win32_OperatingSystem");
ManagementObjectSearcher objsearcher = new ManagementObjectSearcher(scope, query);
ManagementObjectCollection objcol = objsearcher.Get();