ManagementObjectCollection address_set=m_settings. GetRelated (" Msvm_SyntheticEthernetPortSettingData ");
List
Foreach (ManagementObject enic in address_set)
{
String [] connections=(string []) enic (" Connection ");
}
Connections without access to any information, began to suspect that uac control problems, then close the uac or getting less than,
In addition, I query the hyper - v virtual machine switches also fail when information:
String query=the string. Format (" Select * From Msvm_VirtualSwitch ");
ManagementObjectSearcher searcher=new ManagementObjectSearcher (scope, new ObjectQuery (query));
ManagementObjectCollection virtualSwitchs=a searcher. The Get ();
ManagementObject virtualSwitch=null;
Foreach (ManagementObject instance in virtualSwitchs)
{
VirtualSwitch=instance;
break;
}
Visit virtualSwitchs. The Count will throw an exception, and there is no access to VirtualSwitch doubt is the query,
The most important of all, the above two problems, the same code run on win2008 completely no problem,