"Access Denied" when getting MAC addresses with System.Management.ManagementClass -
01-02-2008
, 02:08 PM
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_NetworkAd apterConfiguration");
System.Management.ManagementObjectCollection moc;
moc = mc.GetInstances(); // Throws "Access Denied" exception. |