Пример #1
0
        static public void CreateVirtualEthernetSwitchSettingData(Dictionary <string, object> args, out uint ReturnValue, out ManagementPath Job, out ManagementPath ResultingSystem)
        {
            using (var VESMS = VirtualEthernetSwitchManagementService.GetInstances().First())
                using (var data = VirtualEthernetSwitchSettingData.CreateInstance())
                {
                    args.ToList().ForEach(pair =>
                    {
                        var propertyName  = pair.Key;
                        var propertyValue = pair.Value;

                        switch (propertyName)
                        {
                        case nameof(data.ElementName):
                            data.LateBoundObject[nameof(data.ElementName)] = Convert.ToString(propertyValue);
                            break;

                        case nameof(data.Notes):
                            data.LateBoundObject[nameof(data.Notes)] = ToStringArray(propertyValue);
                            break;

                        default:
                            throw new Exception("Property value not handled or invalid!");
                        }
                    });

                    ManagementPath ReferenceConfiguration = null;
                    var            SystemSettings         = data.LateBoundObject.GetText(TextFormat.WmiDtd20);
                    var            ResourceSettings       = Array.Empty <string>();

                    ReturnValue = VESMS.DefineSystem(ReferenceConfiguration, ResourceSettings, SystemSettings, out Job, out ResultingSystem);
                }
        }
Пример #2
0
 public void CreateInstance_ExpectingNotNullLateBoundObject()
 {
     using (var sut = VirtualEthernetSwitchManagementService.CreateInstance())
     {
         Assert.IsNotNull(sut.LateBoundObject);
     }
 }
Пример #3
0
 public ViridianUtils()
 {
     VSMS  = VirtualSystemManagementService.GetInstances().First();
     IMS   = ImageManagementService.GetInstances().First();
     VSSS  = VirtualSystemSnapshotService.GetInstances().First();
     MS    = MetricService.GetInstances().First();
     VESMS = VirtualEthernetSwitchManagementService.GetInstances().First();
 }