/// <summary>
        /// Creates and returns <see cref="AutoPatchingSettings"/> object.
        /// </summary>
        protected override void ProcessRecord()
        {
            AutoPatchingSettings autoPatchingSettings = new AutoPatchingSettings();

            autoPatchingSettings.Enable    = (Enable.IsPresent) ? Enable.ToBool() : false;
            autoPatchingSettings.DayOfWeek = DayOfWeek;
            autoPatchingSettings.MaintenanceWindowStartingHour = MaintenanceWindowStartingHour;
            autoPatchingSettings.MaintenanceWindowDuration     = MaintenanceWindowDuration;
            autoPatchingSettings.PatchCategory = PatchCategory;

            WriteObject(autoPatchingSettings);
        }
        /// <summary>
        /// Creates and returns <see cref="AutoPatchingSettings"/> object.
        /// </summary>
        protected override void ProcessRecord()
        {
            AutoPatchingSettings autoPatchingSettings = new AutoPatchingSettings();

            autoPatchingSettings.Enable = (Enable.IsPresent) ? Enable.ToBool() : false;
            autoPatchingSettings.DayOfWeek = DayOfWeek;
            autoPatchingSettings.MaintenanceWindowStartingHour = MaintenanceWindowStartingHour;
            autoPatchingSettings.MaintenanceWindowDuration = MaintenanceWindowDuration;
            autoPatchingSettings.PatchCategory = PatchCategory;

            WriteObject(autoPatchingSettings);
        }
コード例 #3
0
        private AutoPatchingSettings DeSerializeAutoPatchingSettings(string category, string input)
        {
            AutoPatchingSettings aps = new AutoPatchingSettings();

            if (!string.IsNullOrEmpty(input))
            {
                try
                {
                    aps = JsonConvert.DeserializeObject <AutoPatchingSettings>(input);
                    aps.PatchCategory = this.ResolvePatchCategoryStringforPowerShell(aps.PatchCategory);
                }
                catch (JsonReaderException jre)
                {
                    WriteVerboseWithTimestamp("Category:" + category);
                    WriteVerboseWithTimestamp("Message:" + input);
                    WriteVerboseWithTimestamp(jre.ToString());
                }
            }

            return(aps);
        }
コード例 #4
0
        private AutoPatchingSettings DeSerializeAutoPatchingSettings(string category, string input)
        {
            AutoPatchingSettings aps = new AutoPatchingSettings();

            if (!string.IsNullOrEmpty(input))
            {
                try
                {
                    aps = JsonConvert.DeserializeObject<AutoPatchingSettings>(input);
                    aps.PatchCategory = this.ResolvePatchCategoryStringforPowerShell(aps.PatchCategory);
                }
                catch (JsonReaderException jre)
                {
                    WriteVerboseWithTimestamp("Category:" + category);
                    WriteVerboseWithTimestamp("Message:" + input);
                    WriteVerboseWithTimestamp(jre.ToString());
                }
            }

            return aps;
        }