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

  • Thread starter Thread starter Orbian
  • Start date Start date
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.
 
Back
Top