string GetMacAddress()
{
var interfaces = NetworkInterface.GetAllNetworkInterfaces();
foreach (var ni in interfaces)
{
if (ni.NetworkInterfaceType == NetworkInterfaceType.Ethernet && ni.OperationalStatus == OperationalStatus.Up)
{
return ni.GetPhysicalAddress().ToString();
}
}
return null;
}
string macAddress = GetMacAddress();
if (macAddress != null)
{
project.Variables["out"].Value = macAddress;
}
else
{
project.Variables["out"].Value = "MAC Address not found";
}