Exemplo n.º 1
0
        private ManagementObject GetRawMachine(string name)
        {
            var en = new ManagementClass(_scope, new ManagementPath("Msvm_ComputerSystem"), null)
                     .GetInstances()
                     .OfType <ManagementObject>().Where(x => (string)x["Caption"] == "Виртуальная машина" || "Virtual Machine" == (string)x["Caption"]);

            return(en.FirstOrDefault(x => x["ElementName"] as string == name));
        }