Ejemplo n.º 1
0
        public IHyperVMachine GetMachineByName(string name)
        {
            var en = new ManagementClass(_scope, new ManagementPath("Msvm_ComputerSystem"), null)
                     .GetInstances()
                     .OfType <ManagementObject>().Where(x => "Virtual Machine" == (string)x["Caption"]);

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