private List<string> GetMac()
{
List<string> macs = new List<string>();
try
{
var mc = new ManagementClass("Win32_NetworkAdapterConfiguration");
var moc = mc.GetInstances();
foreach (var mo in moc)
{
if (!(bool)mo["IPEnabled"])
continue;
var mac = mo["MacAddress"].ToString();
macs.Add(mac);
}
}
catch
{
}
return macs;
}
时间: 2024-10-13 06:10:42