"Access Denied" when getting MAC addresses with System.Management.ManagementClass

O

Orbian

Hello,

I am having trouble getting the MAC addresses on some machines using
the Management class. The code below works on most machines, but on
some I get an "Access Denied" exception when performing a
GetInstances() call on some machines. Any ideas on what might be
causing this? Is there any other way to get the MAC adresses?


System.Management.ManagementClass mc;
mc = new
System.Management.ManagementClass("Win32_NetworkAdapterConfiguration");

System.Management.ManagementObjectCollection moc;
moc = mc.GetInstances(); // Throws "Access Denied" exception.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top