{"record":{"id":"815d44d859b4627a","repo":"peass-ng/PEASS-ng","slug":"task-history-not-available-on-systems-prior-to-win","errorCode":null,"errorMessage":"Task history not available on systems prior to Windows Vista and Windows Server 2008.","messagePattern":"Task history not available on systems prior to Windows Vista and Windows Server 2008\\.","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"winPEAS/winPEASexe/winPEAS/TaskScheduler/TaskEvent.cs","lineNumber":822,"sourceCode":"        /// <summary>\n        /// Gets or sets a value indicating whether this <see cref=\"TaskEventLog\" /> is enabled.\n        /// </summary>\n        /// <value>\n        /// <c>true</c> if enabled; otherwise, <c>false</c>.\n        /// </value>\n        public bool Enabled\n        {\n            get\n            {\n                if (!IsVistaOrLater)\n                    return false;\n                using (var cfg = new EventLogConfiguration(TSEventLogPath, Query.Session))\n                    return cfg.IsEnabled;\n            }\n            set\n            {\n                if (!IsVistaOrLater)\n                    throw new NotSupportedException(\"Task history not available on systems prior to Windows Vista and Windows Server 2008.\");\n                using (var cfg = new EventLogConfiguration(TSEventLogPath, Query.Session))\n                {\n                    if (cfg.IsEnabled != value)\n                    {\n                        cfg.IsEnabled = value;\n                        cfg.SaveChanges();\n                    }\n                }\n            }\n        }\n\n        /// <summary>\n        /// Gets or sets a value indicating whether to enumerate in reverse when calling the default enumerator (typically with foreach statement).\n        /// </summary>\n        /// <value>\n        ///   <c>true</c> if enumerates in reverse (newest to oldest) by default; otherwise, <c>false</c> to enumerate oldest to newest.\n        /// </value>\n        [System.ComponentModel.DefaultValue(false)]","sourceCodeStart":804,"sourceCodeEnd":840,"githubUrl":"https://github.com/peass-ng/PEASS-ng/blob/53fb989abc2219826385683a6fee826bd6cd38d6/winPEAS/winPEASexe/winPEAS/TaskScheduler/TaskEvent.cs#L804-L840","documentation":"The Enabled setter on TaskEventLog throws NotSupportedException when IsVistaOrLater is false. Enabling/disabling the Task Scheduler operational event log requires the Vista+ EventLogConfiguration API, which is unavailable on XP/2003.","triggerScenarios":"Setting the TaskEventLog.Enabled property (e.g. log.Enabled = true) on a pre-Vista system, hitting the IsVistaOrLater guard before EventLogConfiguration is created.","commonSituations":"Code that enables task-history logging as part of setup or audit tooling running on legacy Windows; scripts that unconditionally toggle the TaskScheduler operational channel.","solutions":["Guard the Enabled assignment with an OS version check (>= 6.0) and skip on legacy systems","Catch NotSupportedException around the setter and log/handle the unsupported case","Enable task history only on Vista+ machines where the EventLog channel exists"],"exampleFix":"// before\nlog.Enabled = true;\n// after\nif (TaskEventLog.IsVistaOrLater) log.Enabled = true;","handlingStrategy":"validation","validationCode":"if (Environment.OSVersion.Version.Major >= 6) log.Enabled = value;","typeGuard":null,"tryCatchPattern":"try { log.Enabled = true; }\ncatch (NotSupportedException) { /* enabling history unsupported pre-Vista */ }","preventionTips":["Only toggle the TaskScheduler operational channel on Vista+ hosts","Wrap log-configuration code in OS-version checks","Log a warning instead of throwing when history can't be enabled"],"tags":["windows","taskscheduler","eventlog","notsupported"],"backgroundTag":"platform-not-supported","analyzedSha":"53fb989abc2219826385683a6fee826bd6cd38d6","analyzedAt":"2026-09-02T04:25:09.259Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T11:17:12.671Z"}