{"record":{"id":"01d0333cdcd6994c","repo":"peass-ng/PEASS-ng","slug":"unsupported-priority-level-on-task-scheduler-1-0","errorCode":null,"errorMessage":"Unsupported priority level on Task Scheduler 1.0.","messagePattern":"Unsupported priority level on Task Scheduler 1\\.0\\.","errorType":"exception","errorClass":"NotV1SupportedException","httpStatus":null,"severity":"error","filePath":"winPEAS/winPEASexe/winPEAS/TaskScheduler/Task.cs","lineNumber":3333,"sourceCode":"        }\n\n        /// <summary>Gets or sets the priority level of the task.</summary>\n        /// <value>The priority.</value>\n        /// <exception cref=\"NotV1SupportedException\">Value set to AboveNormal or BelowNormal on Task Scheduler 1.0.</exception>\n        [DefaultValue(typeof(ProcessPriorityClass), \"Normal\")]\n        public ProcessPriorityClass Priority\n        {\n            get => v2Settings != null ? GetPriorityFromInt(v2Settings.Priority) : (ProcessPriorityClass)v1Task.GetPriority();\n            set\n            {\n                if (v2Settings != null)\n                {\n                    v2Settings.Priority = GetPriorityAsInt(value);\n                }\n                else\n                {\n                    if (value == ProcessPriorityClass.AboveNormal || value == ProcessPriorityClass.BelowNormal)\n                        throw new NotV1SupportedException(\"Unsupported priority level on Task Scheduler 1.0.\");\n                    v1Task.SetPriority((uint)value);\n                }\n                OnNotifyPropertyChanged();\n            }\n        }\n\n        /// <summary>Gets or sets the number of times that the Task Scheduler will attempt to restart the task.</summary>\n        /// <value>\n        /// The number of times that the Task Scheduler will attempt to restart the task. If this property is set, the <see\n        /// cref=\"RestartInterval\"/> property must also be set.\n        /// </value>\n        /// <exception cref=\"NotV1SupportedException\">Not supported under Task Scheduler 1.0.</exception>\n        [DefaultValue(0)]\n        [XmlIgnore]\n        public int RestartCount\n        {\n            get => v2Settings?.RestartCount ?? 0;\n            set","sourceCodeStart":3315,"sourceCodeEnd":3351,"githubUrl":"https://github.com/peass-ng/PEASS-ng/blob/53fb989abc2219826385683a6fee826bd6cd38d6/winPEAS/winPEASexe/winPEAS/TaskScheduler/Task.cs#L3315-L3351","documentation":"Task Scheduler 1.0 (Windows XP/2000) does not support the AboveNormal or BelowNormal process priority classes. The TaskDefinition.Principal.Priority setter throws NotV1SupportedException when these values are applied to a v1 task.","triggerScenarios":"Setting taskDefinition.Principal.Priority = ProcessPriorityClass.AboveNormal or BelowNormal on a task backed by Task Scheduler 1.0 (v1Task, no v2Settings).","commonSituations":"Running on/creating tasks for legacy Windows; code that unconditionally assigns a priority chosen from a dropdown including AboveNormal/BelowNormal; shared code paths not distinguishing v1/v2 task services.","solutions":["Restrict priority values to Idle, Normal, High, or RealTime on v1 tasks","Default to ProcessPriorityClass.Normal when the Task Scheduler version is 1.0","Check TaskService.HighestSupportedVersion before setting the priority","Guard with a try-catch around the setter if the value is user-supplied"],"exampleFix":"// before\nprincipal.Priority = ProcessPriorityClass.AboveNormal;\n// after\nif (svc.HighestSupportedVersion < TaskServiceVersion.V2)\n    principal.Priority = ProcessPriorityClass.Normal;\nelse\n    principal.Priority = ProcessPriorityClass.AboveNormal;","handlingStrategy":"validation","validationCode":"if (svc.HighestSupportedVersion < TaskServiceVersion.V2 &&\n    (priority == ProcessPriorityClass.AboveNormal || priority == ProcessPriorityClass.BelowNormal))\n    priority = ProcessPriorityClass.Normal;","typeGuard":"bool IsV1Safe(ProcessPriorityClass p) => p == ProcessPriorityClass.Idle || p == ProcessPriorityClass.Normal || p == ProcessPriorityClass.High || p == ProcessPriorityClass.RealTime;","tryCatchPattern":"try { principal.Priority = value; }\ncatch (NotV1SupportedException) { principal.Priority = ProcessPriorityClass.Normal; }","preventionTips":["Restrict priority choices on v1 tasks to Idle/Normal/High/RealTime","Check TaskService.HighestSupportedVersion before setting v2-only settings"],"tags":["taskscheduler","notv1supported","priority","legacy-windows"],"backgroundTag":"unsupported-platform-feature","analyzedSha":"53fb989abc2219826385683a6fee826bd6cd38d6","analyzedAt":"2026-09-02T04:25:09.259Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T11:17:12.671Z"}