peass-ng/PEASS-ng · error · NotV1SupportedException

Unsupported priority level on Task Scheduler 1.0.

Error message

Unsupported priority level on Task Scheduler 1.0.

What it means

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.

Source

Thrown at winPEAS/winPEASexe/winPEAS/TaskScheduler/Task.cs:3333

        }

        /// <summary>Gets or sets the priority level of the task.</summary>
        /// <value>The priority.</value>
        /// <exception cref="NotV1SupportedException">Value set to AboveNormal or BelowNormal on Task Scheduler 1.0.</exception>
        [DefaultValue(typeof(ProcessPriorityClass), "Normal")]
        public ProcessPriorityClass Priority
        {
            get => v2Settings != null ? GetPriorityFromInt(v2Settings.Priority) : (ProcessPriorityClass)v1Task.GetPriority();
            set
            {
                if (v2Settings != null)
                {
                    v2Settings.Priority = GetPriorityAsInt(value);
                }
                else
                {
                    if (value == ProcessPriorityClass.AboveNormal || value == ProcessPriorityClass.BelowNormal)
                        throw new NotV1SupportedException("Unsupported priority level on Task Scheduler 1.0.");
                    v1Task.SetPriority((uint)value);
                }
                OnNotifyPropertyChanged();
            }
        }

        /// <summary>Gets or sets the number of times that the Task Scheduler will attempt to restart the task.</summary>
        /// <value>
        /// The number of times that the Task Scheduler will attempt to restart the task. If this property is set, the <see
        /// cref="RestartInterval"/> property must also be set.
        /// </value>
        /// <exception cref="NotV1SupportedException">Not supported under Task Scheduler 1.0.</exception>
        [DefaultValue(0)]
        [XmlIgnore]
        public int RestartCount
        {
            get => v2Settings?.RestartCount ?? 0;
            set

View on GitHub (pinned to 53fb989abc)

Solutions

  1. Restrict priority values to Idle, Normal, High, or RealTime on v1 tasks
  2. Default to ProcessPriorityClass.Normal when the Task Scheduler version is 1.0
  3. Check TaskService.HighestSupportedVersion before setting the priority
  4. Guard with a try-catch around the setter if the value is user-supplied

Example fix

// before
principal.Priority = ProcessPriorityClass.AboveNormal;
// after
if (svc.HighestSupportedVersion < TaskServiceVersion.V2)
    principal.Priority = ProcessPriorityClass.Normal;
else
    principal.Priority = ProcessPriorityClass.AboveNormal;
Defensive patterns

Strategy: validation

Validate before calling

if (svc.HighestSupportedVersion < TaskServiceVersion.V2 &&
    (priority == ProcessPriorityClass.AboveNormal || priority == ProcessPriorityClass.BelowNormal))
    priority = ProcessPriorityClass.Normal;

Type guard

bool IsV1Safe(ProcessPriorityClass p) => p == ProcessPriorityClass.Idle || p == ProcessPriorityClass.Normal || p == ProcessPriorityClass.High || p == ProcessPriorityClass.RealTime;

Try / catch

try { principal.Priority = value; }
catch (NotV1SupportedException) { principal.Priority = ProcessPriorityClass.Normal; }

Prevention

When it happens

Trigger: Setting taskDefinition.Principal.Priority = ProcessPriorityClass.AboveNormal or BelowNormal on a task backed by Task Scheduler 1.0 (v1Task, no v2Settings).

Common situations: 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.

Related errors


AI-assisted analysis of peass-ng/PEASS-ng@53fb989abc (2026-09-02). Data as JSON: /api/errors/01d0333cdcd6994c. Report an issue: GitHub.