I’ve got a Hyper-V host, with several guests, each with one or more network adapters. How do I enumerate the network adapters on those guests?
Specifically, I’m looking for a particular guest, given a MAC address.
I’m using C# and System.Management.
I’ll leave out some of the details:
SELECT * FROM Msvm_ComputerSystem).Msvm_SyntheticEthernetPortobjects.var ports = computerSystem.GetRelated("Msvm_SyntheticEthernetPort"); foreach (ManagementObject port in ports) {var portSettings = port.GetRelated("Msvm_SyntheticEthernetPortSettingData"); foreach (ManagmentObject portSetting in portSettings) {string macAddress = (string)portSetting .GetPropertyValue("Address");