{"record":{"id":"c0566bcba4b73249","repo":"peass-ng/PEASS-ng","slug":"a-maximum-of-32-parameters-can-be-supplied-to-rune","errorCode":null,"errorMessage":"A maximum of 32 parameters can be supplied to RunEx.","messagePattern":"A maximum of 32 parameters can be supplied to RunEx\\.","errorType":"validation","errorClass":"ArgumentOutOfRangeException","httpStatus":null,"severity":"error","filePath":"winPEAS/winPEASexe/winPEAS/TaskScheduler/Task.cs","lineNumber":1479,"sourceCode":"        /// <para>If RunEx is invoked from a disabled task, it will return <c>null</c> and the task will not be run.</para>\n        /// </remarks>\n        /// <exception cref=\"NotV1SupportedException\">Not supported under Task Scheduler 1.0.</exception>\n        /// <example>\n        /// <code lang=\"cs\">\n        ///<![CDATA[\n        /// // Run the current task with a parameter as a different user and ignoring any of the conditions.\n        /// var runningTask = myTaskInstance.RunEx(TaskRunFlags.IgnoreConstraints, 0, \"DOMAIN\\\\User\", \"info\");\n        /// Console.Write(string.Format(\"Running task's current action is {0}.\", runningTask.CurrentAction));\n        ///]]>\n        /// </code>\n        /// </example>\n        public RunningTask RunEx(TaskRunFlags flags, int sessionID, string user, params string[] parameters)\n        {\n            if (v2Task == null) throw new NotV1SupportedException();\n            if (parameters == null || parameters.Any(s => s == null))\n                throw new ArgumentNullException(nameof(parameters), \"The array and none of the values passed as parameters may be `null`.\");\n            if (parameters.Length > 32)\n                throw new ArgumentOutOfRangeException(nameof(parameters), \"A maximum of 32 parameters can be supplied to RunEx.\");\n            if (TaskService.HighestSupportedVersion < TaskServiceVersion.V1_5 && parameters.Any(p => (p?.Length ?? 0) >= 260))\n                throw new ArgumentOutOfRangeException(nameof(parameters), \"On systems prior to Windows 10, no individual parameter may be more than 260 characters.\");\n            var irt = v2Task.RunEx(parameters.Length == 0 ? null : parameters, (int)flags, sessionID, user);\n            return irt != null ? new RunningTask(TaskService, v2Task, irt) : null;\n        }\n\n        /// <summary>\n        /// Applies access control list (ACL) entries described by a <see cref=\"TaskSecurity\"/> object to the file described by the current\n        /// <see cref=\"Task\"/> object.\n        /// </summary>\n        /// <param name=\"taskSecurity\">\n        /// A <see cref=\"TaskSecurity\"/> object that describes an access control list (ACL) entry to apply to the current task.\n        /// </param>\n        /// <example>\n        /// <para>Give read access to all authenticated users for a task.</para>\n        /// <code lang=\"cs\">\n        ///<![CDATA[\n        /// // Assume variable 'task' is a valid Task instance","sourceCodeStart":1461,"sourceCodeEnd":1497,"githubUrl":"https://github.com/peass-ng/PEASS-ng/blob/53fb989abc2219826385683a6fee826bd6cd38d6/winPEAS/winPEASexe/winPEAS/TaskScheduler/Task.cs#L1461-L1497","documentation":"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.","triggerScenarios":"Calling task.RunEx(flags, sessionID, user, params) with parameters.Length > 32.","commonSituations":"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.","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"],"exampleFix":"// before\ntask.RunEx(flags, 0, null, allFiles); // allFiles.Length may exceed 32\n// after\nvar args = allFiles.Take(32).ToArray();\ntask.RunEx(flags, 0, null, args);","handlingStrategy":"fallback","validationCode":"if (parameters != null && parameters.Length > 32)\n    throw new ArgumentException(\"RunEx accepts at most 32 parameters\");","typeGuard":null,"tryCatchPattern":"try { task.RunEx(flags, sid, user, parameters); }\ncatch (ArgumentOutOfRangeException) { /* pack args into a file or split runs */ }","preventionTips":["Assert parameters.Length <= 32 in argument-building code","Aggregate many values into a single config file parameter"],"tags":["taskscheduler","argumentoutofrange","limits","csharp"],"backgroundTag":"argument-limit-exceeded","analyzedSha":"53fb989abc2219826385683a6fee826bd6cd38d6","analyzedAt":"2026-09-02T04:25:09.259Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T11:17:12.671Z"}