locked
Way around domain requirement for remote wmi connectivity RRS feed

  • Question

  • Hi,

    First of all, I hope I am in the correct forum (and category).

    I am trying to connect to another computer on my network (which does not have a domain environment). I want to connect through the following code in Visual C#:

    ConnectionOptions co = new ConnectionOptions();
    
    co.Username = srvr_username;
    co.Password = srvr_pwd;
    string remMachine = srvr_IP;
    ManagementScope scope = new ManagementScope(@"\\" + remMachine + @"\root\cimv2", co);
    
    SelectQuery selectQuery = new SelectQuery("Select * from Win32_PerfRawData_PerfProc_Process");// where Started = 'True'");
    using (ManagementObjectSearcher searcher = new ManagementObjectSearcher(scope, selectQuery))
    {
    foreach (ManagementObject proc in searcher.Get())
    {
    chkProcessList.Items.Add(proc["Name"].ToString());
    }
    }
    My problem is that when I use a domain environment, this code works perfectly. But in a no domain environment, even with the administrative users, I still end up getting an Access Denied exception. I have tested this on wmimgmt.msc as well, and get the same error.

    I know that even MSDN states that I have to do this in a domain environment and with a domain user with administrative rights on the system I am trying to access. I wanted to know, if it was possible to do this without a domain user, or without a domain environment... perhaps there was some windows patch (some mysterious exe lurking on Microsoft's networks) that would help me with my problem.

    Thanks.
    Tuesday, May 12, 2009 10:17 AM

Answers

  • Well, you are probably not in the right forum for your question.  I would suggest looking at http://msdn.microsoft.com/en-us/netframework and the APIs you are using and try and determine which forum the APIs fit into.  Perhaps communication or something in that area.

    You might be able to use Network Monitor, the tool to which this forum is devoted, to help troubleshoot your issue.  If you take a network trace with Network Monitor you might be able to discover how the appliation is trying to connect and give you clues to what is happening.  It will take some knowlege of Microsoft protocols, but the persons familiar with these calls on the appropriate forum might be able to also make sense out of a trace .

    Thanks,

    Paul
    • Marked as answer by Paul E Long Tuesday, May 12, 2009 6:03 PM
    Tuesday, May 12, 2009 1:58 PM