peass-ng/PEASS-ng · error · NotV1SupportedException

Only a single {nameof(Action.ExecAction)} is supported unles

Error message

Only a single {nameof(Action.ExecAction)} is supported unless the {nameof(PowerShellConversion)} property includes the {nameof(PowerShellActionPlatformOption.Version1)} value.

What it means

On Task Scheduler v1 (Windows XP/Server 2003) only one action is supported natively; the library emulates multiple actions via PowerShell conversion, but only when PowerShellConversion includes PowerShellActionPlatformOption.Version1. Add throws NotV1SupportedException when, under v1, PowerShell conversion is off and either an action already exists or the new action is not an ExecAction.

Source

Thrown at winPEAS/winPEASexe/winPEAS/TaskScheduler/ActionCollection.cs:294

            get => this[index];
            set => this[index] = (Action)value;
        }

        /// <summary>Adds an action to the task.</summary>
        /// <typeparam name="TAction">A type derived from <see cref="Action"/>.</typeparam>
        /// <param name="action">A derived <see cref="Action"/> class.</param>
        /// <returns>The bound <see cref="Action"/> that was added to the collection.</returns>
        [NotNull]
        public TAction Add<TAction>([NotNull] TAction action) where TAction : Action
        {
            if (action == null)
                throw new ArgumentNullException(nameof(action));
            if (v2Def != null)
                action.Bind(v2Def);
            else
            {
                if (!SupportV1Conversion && (v1Actions.Count >= 1 || !(action is Action.ExecAction)))
                    throw new NotV1SupportedException($"Only a single {nameof(Action.ExecAction)} is supported unless the {nameof(PowerShellConversion)} property includes the {nameof(PowerShellActionPlatformOption.Version1)} value.");
                v1Actions.Add(action);
                SaveV1Actions();
            }
            OnNotifyPropertyChanged(nameof(Count));
            OnNotifyPropertyChanged(IndexerName);
            CollectionChanged?.Invoke(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, action));
            return action;
        }

        /// <summary>Adds an <see cref="Action.ExecAction"/> to the task.</summary>
        /// <param name="path">Path to an executable file.</param>
        /// <param name="arguments">Arguments associated with the command-line operation. This value can be null.</param>
        /// <param name="workingDirectory">
        /// Directory that contains either the executable file or the files that are used by the executable file. This value can be null.
        /// </param>
        /// <returns>The bound <see cref="Action.ExecAction"/> that was added to the collection.</returns>
        [NotNull]
        public Action.ExecAction Add([NotNull] string path, [CanBeNull] string arguments = null, [CanBeNull] string workingDirectory = null) =>

View on GitHub (pinned to 53fb989abc)

Solutions

  1. Set task.Definition.Actions.PowerShellConversion = PowerShellActionPlatformOption.Version1 before adding multiple/non-Exec actions under v1
  2. Target Task Scheduler 2.0 (Vista+) so multiple native actions are supported
  3. Consolidate v1 logic into a single ExecAction running a script that performs all steps
  4. Catch NotV1SupportedException and either upgrade the platform target or warn about lost functionality

Example fix

// before
var def = ts.CreateTask(...); // v1 target
def.Actions.Add(new ExecAction("a.exe"));
def.Actions.Add(new ExecAction("b.exe")); // throws
// after
def.Actions.PowerShellConversion = PowerShellActionPlatformOption.Version1;
def.Actions.Add(new ExecAction("a.exe"));
def.Actions.Add(new ExecAction("b.exe"));
Defensive patterns

Strategy: try-catch

Validate before calling

static bool CanAddActionV1(ActionCollection actions, TaskAction action) =>
    actions.SupportV1Conversion ||
    (actions.Count == 0 && action is Action.ExecAction);

Try / catch

try { def.Actions.Add(action); }
catch (NotV1SupportedException)
{
    log.Warn("Target platform v1 supports only one ExecAction; enable PowerShellConversion.Version1 or upgrade to v2.");
}

Prevention

When it happens

Trigger: Calling Add (directly or via AddRange/Insert/ReadXml) on a task targeting v1 with PowerShellConversion not including Version1, when: a second action is added after an ExecAction, or the added action is an EmailAction/ShowMessageAction/COM handler action.

Common situations: Building tasks that must run on legacy Windows; loading a multi-action task definition into a v1 TaskService instance without enabling PowerShell conversion; adding an EmailAction on XP-era compatibility paths.

Related errors


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