Example #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);
                }
        }
Example #2
0
        public void SUT_VirtualEthernetSwitchSettingDataMO(string ElementName, string Notes, out uint ReturnValue, out ManagementPath Job, out ManagementPath ResultingSystem)
        {
            using (var virtualEthernetSwitchSettingData = VirtualEthernetSwitchSettingData.CreateInstance())
            {
                virtualEthernetSwitchSettingData.LateBoundObject["ElementName"] = ElementName;
                virtualEthernetSwitchSettingData.LateBoundObject["Notes"]       = new string[] { Notes };

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

                ReturnValue = VESMS.DefineSystem(ReferenceConfiguration, ResourceSettings, SystemSettings, out Job, out ResultingSystem);

                VESSD_ToDestroy.Add(ResultingSystem);
            }
        }