Exemplo n.º 1
0
        public static IVirtualSystemSettingData GetVirtualSystemSettingDataByVmUuid(ManagementScope scope, string vmUuid)
        {
            IVirtualSystemSettingData systemSettingData = VirtualSystemSettingData.Query(scope, "VirtualSystemIdentifier='{0}'", (object)vmUuid).Where <IVirtualSystemSettingData>((Func <IVirtualSystemSettingData, bool>)(vssd => vssd.VirtualSystemType == "Microsoft:Hyper-V:System:Realized")).FirstOrDefault <IVirtualSystemSettingData>();

            if (systemSettingData != null)
            {
                return(systemSettingData);
            }
            throw new HyperVException("VirtualSystemSettingData not found for VM uuid " + vmUuid);
        }
Exemplo n.º 2
0
        public static IVirtualSystemSettingData GetVirtualSystemSettingDataByName(ManagementScope scope, string name)
        {
            IVirtualSystemSettingData systemSettingData = VirtualSystemSettingData.Query(scope, "ElementName='{0}'", (object)name).Where <IVirtualSystemSettingData>((Func <IVirtualSystemSettingData, bool>)(vssd => vssd.VirtualSystemType == "Microsoft:Hyper-V:System:Realized")).FirstOrDefault <IVirtualSystemSettingData>();

            if (systemSettingData != null)
            {
                return(systemSettingData);
            }
            throw new HyperVException("VirtualSystemSettingData not found for VM name " + name);
        }
Exemplo n.º 3
0
        public static IEnumerable <IVirtualSystemSettingData> Query(ManagementScope scope, string condition, params object[] args)
        {
            string condition1 = string.Format(condition, args);

            return(VirtualSystemSettingData.Query(scope, condition1));
        }