peass-ng/PEASS-ng · error · ArgumentOutOfRangeException
A maximum of 32 parameters can be supplied to RunEx.
Error message
A maximum of 32 parameters can be supplied to RunEx.
What it means
RunEx documents this NotV1SupportedException condition: Task Scheduler 1.0 (Windows XP/2000) does not support RunEx's extended run options, so invoking RunEx on a v1 system throws this exception. It is a platform-capability error, not a data validation failure.
Source
Thrown at winPEAS/winPEASexe/winPEAS/TaskScheduler/Task.cs:1479
/// <para>If RunEx is invoked from a disabled task, it will return <c>null</c> and the task will not be run.</para>
/// </remarks>
/// <exception cref="NotV1SupportedException">Not supported under Task Scheduler 1.0.</exception>
/// <example>
/// <code lang="cs">
///<![CDATA[
/// // Run the current task with a parameter as a different user and ignoring any of the conditions.
/// var runningTask = myTaskInstance.RunEx(TaskRunFlags.IgnoreConstraints, 0, "DOMAIN\\User", "info");
/// Console.Write(string.Format("Running task's current action is {0}.", runningTask.CurrentAction));
///]]>
/// </code>
/// </example>
public RunningTask RunEx(TaskRunFlags flags, int sessionID, string user, params string[] parameters)
{
if (v2Task == null) throw new NotV1SupportedException();
if (parameters == null || parameters.Any(s => s == null))
throw new ArgumentNullException(nameof(parameters), "The array and none of the values passed as parameters may be `null`.");
if (parameters.Length > 32)
throw new ArgumentOutOfRangeException(nameof(parameters), "A maximum of 32 parameters can be supplied to RunEx.");
if (TaskService.HighestSupportedVersion < TaskServiceVersion.V1_5 && parameters.Any(p => (p?.Length ?? 0) >= 260))
throw new ArgumentOutOfRangeException(nameof(parameters), "On systems prior to Windows 10, no individual parameter may be more than 260 characters.");
var irt = v2Task.RunEx(parameters.Length == 0 ? null : parameters, (int)flags, sessionID, user);
return irt != null ? new RunningTask(TaskService, v2Task, irt) : null;
}
/// <summary>
/// Applies access control list (ACL) entries described by a <see cref="TaskSecurity"/> object to the file described by the current
/// <see cref="Task"/> object.
/// </summary>
/// <param name="taskSecurity">
/// A <see cref="TaskSecurity"/> object that describes an access control list (ACL) entry to apply to the current task.
/// </param>
/// <example>
/// <para>Give read access to all authenticated users for a task.</para>
/// <code lang="cs">
///<![CDATA[
/// // Assume variable 'task' is a valid Task instanceView on GitHub (pinned to 53fb989abc)
Solutions
- Reduce the argument count to 32 or fewer
- Pack multiple values into a single delimited parameter or a config file and pass its path
- Use ArgumentString-style approaches (encode all args into one quoted string if the target executable parses it)
- Split the work across multiple task runs
Example fix
// before task.RunEx(flags, 0, null, allFiles); // allFiles.Length may exceed 32 // after var args = allFiles.Take(32).ToArray(); task.RunEx(flags, 0, null, args);
Defensive patterns
Strategy: fallback
Validate before calling
if (parameters != null && parameters.Length > 32)
throw new ArgumentException("RunEx accepts at most 32 parameters"); Try / catch
try { task.RunEx(flags, sid, user, parameters); }
catch (ArgumentOutOfRangeException) { /* pack args into a file or split runs */ } Prevention
- Assert parameters.Length <= 32 in argument-building code
- Aggregate many values into a single config file parameter
When it happens
Trigger: Calling task.RunEx(flags, sessionID, user, params) with parameters.Length > 32.
Common situations: Forwarding an unbounded argument list (e.g. all files in a folder, a large set of flags) directly to the task; scripts that accumulate arguments programmatically.
Related errors
- Data Overflow
- A maximum of 32 actions is allowed within a single task.
- Attachments array cannot contain more than 8 items.
- Each value of the array must contain a valid file reference.
- Under Windows 8 and later, EmailAction objects are converted
AI-assisted analysis of peass-ng/PEASS-ng@53fb989abc (2026-09-02).
Data as JSON: /api/errors/c0566bcba4b73249.
Report an issue: GitHub.