tags:

views:

115

answers:

1
 string s = Form1.ipadd;
            string devic;
            devic = comboBox1.Text;
            groupBox2.Text = devic + "  Information";
            ConnectionOptions _Options = new ConnectionOptions();
            _Options.Username = "Babar";
            _Options.Password = "";
            ManagementPath _Path = new ManagementPath(s);

            ManagementScope _Scope = new ManagementScope(_Path, _Options);
            _Scope.Connect();
            ManagementObjectSearcher srcd = new ManagementObjectSearcher("select * from "+devic);
            tsprogress.Value = 0;
            Allplabel.Text = " : 0%";
            foreach (ManagementObject obj in srcd.Get())
            {


                //listBox5.Items.Add(obj.Properties.ToString());
                foreach (PropertyData aProperty in obj.Properties)
                {
                    i++;
                    tsprogress.Value = (i / cont) * 100;
                    Allplabel.Text = tsprogress.Value.ToString() + "%";
                    richTextBox1.AppendText(aProperty.Name.ToString() + " : " + aProperty.Value+"\n");


                }

            }

///////////////////////// The above code works fine on local host but does not works while accessing remote system......Accesses denied excption ...i shall b very thankful 2 your help.

A: 

Hi !

The problem looks like the same, you've asked for in another question [http://stackoverflow.com/questions/1894730/access-is-denied-exception-with-wmi]. See my answer there.

br--mabra

mabra