{"record":{"id":"bf786eb3abf65690","repo":"peass-ng/PEASS-ng","slug":"on-systems-prior-to-windows-10-all-individual-par","errorCode":null,"errorMessage":"On systems prior to Windows 10, all individual parameters must be less than 260 characters.","messagePattern":"On systems prior to Windows 10, all individual parameters must be less than 260 characters\\.","errorType":"validation","errorClass":"ArgumentOutOfRangeException","httpStatus":null,"severity":"error","filePath":"winPEAS/winPEASexe/winPEAS/TaskScheduler/Task.cs","lineNumber":1404,"sourceCode":"        /// </param>\n        /// <returns>A <see cref=\"RunningTask\"/> instance that defines the new instance of the task.</returns>\n        /// <example>\n        /// <code lang=\"cs\">\n        ///<![CDATA[\n        /// // Run the current task with a parameter\n        /// var runningTask = myTaskInstance.Run(\"info\");\n        /// Console.Write(string.Format(\"Running task's current action is {0}.\", runningTask.CurrentAction));\n        ///]]>\n        /// </code>\n        /// </example>\n        public RunningTask Run(params string[] parameters)\n        {\n            if (v2Task != null)\n            {\n                if (parameters.Length > 32)\n                    throw new ArgumentOutOfRangeException(nameof(parameters), \"A maximum of 32 values is allowed.\");\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, all individual parameters must be less than 260 characters.\");\n                var irt = v2Task.Run(parameters.Length == 0 ? null : parameters);\n                return irt != null ? new RunningTask(TaskService, v2Task, irt) : null;\n            }\n\n            v1Task.Run();\n            return new RunningTask(TaskService, v1Task);\n        }\n\n        /// <summary>Runs the registered task immediately using specified flags and a session identifier.</summary>\n        /// <param name=\"flags\">Defines how the task is run.</param>\n        /// <param name=\"sessionID\">\n        /// <para>The terminal server session in which you want to start the task.</para>\n        /// <para>\n        /// If the <see cref=\"TaskRunFlags.UseSessionId\"/> value is not passed into the <paramref name=\"flags\"/> parameter, then the value\n        /// specified in this parameter is ignored.If the <see cref=\"TaskRunFlags.UseSessionId\"/> value is passed into the flags parameter\n        /// and the sessionID value is less than or equal to 0, then an invalid argument error will be returned.\n        /// </para>\n        /// <para>","sourceCodeStart":1386,"sourceCodeEnd":1422,"githubUrl":"https://github.com/peass-ng/PEASS-ng/blob/53fb989abc2219826385683a6fee826bd6cd38d6/winPEAS/winPEASexe/winPEAS/TaskScheduler/Task.cs#L1386-L1422","documentation":"Task.Run() validates the parameters array before passing it to the native Task Scheduler COM API. On systems whose highest supported Task Scheduler version is below 1.5 (pre-Windows 10), any individual parameter string of 260 or more characters triggers this ArgumentOutOfRangeException, because the older native API cannot accept such long parameters.","triggerScenarios":"Calling task.Run(...) with one or more parameter strings whose length is >= 260 while running on a system where TaskService.HighestSupportedVersion < TaskServiceVersion.V1_5. Also thrown when more than 32 values are supplied.","commonSituations":"Passing long file paths, long command-line arguments, or encoded blobs as task parameters on Windows 7/8/8.1 or when targeting a down-level remote machine.","solutions":["Shorten each parameter string to under 260 characters (e.g. pass a path to a script file instead of inline content)","Detect the OS version at runtime and use a different invocation strategy (e.g. write arguments to a temp file and pass its short path)","Upgrade/target Windows 10+ where Task Scheduler 1.5 supports longer parameters","Ensure no more than 32 parameters are passed (also enforced here)"],"exampleFix":"// before\ntask.Run(longConfigJson);\n// after\nif (longConfigJson.Length >= 260)\n    File.WriteAllText(tempFile, longConfigJson);\ntask.Run(tempFile);","handlingStrategy":"validation","validationCode":"if (TaskService.HighestSupportedVersion < TaskServiceVersion.V1_5)\n    foreach (var p in parameters)\n        if (p != null && p.Length >= 260) throw new ArgumentException(\"Parameter exceeds 260 chars on pre-Win10: \" + p);","typeGuard":null,"tryCatchPattern":"try { task.Run(parameters); }\ncatch (ArgumentOutOfRangeException ex) { /* shorten params or fallback */ }","preventionTips":["Check TaskService.HighestSupportedVersion before long parameters","Keep task parameters as short paths, not inline data","Cap parameters at 32 items and 259 chars each"],"tags":["taskscheduler","argumentoutofrange","path-length","windows"],"backgroundTag":"argument-length-exceeds-limit","analyzedSha":"53fb989abc2219826385683a6fee826bd6cd38d6","analyzedAt":"2026-09-02T04:25:09.259Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T11:17:12.671Z"}