{"record":{"id":"c9c6571604fec34b","repo":"peass-ng/PEASS-ng","slug":"on-systems-prior-to-windows-10-no-individual-para","errorCode":null,"errorMessage":"On systems prior to Windows 10, no individual parameter may be more than 260 characters.","messagePattern":"On systems prior to Windows 10, no individual parameter may be more than 260 characters\\.","errorType":"validation","errorClass":"ArgumentOutOfRangeException","httpStatus":null,"severity":"error","filePath":"winPEAS/winPEASexe/winPEAS/TaskScheduler/Task.cs","lineNumber":1481,"sourceCode":"        /// <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\n        /// var taskSecurity = task.GetAccessControl();\n        /// taskSecurity.AddAccessRule(new TaskAccessRule(\"Authenticated Users\", TaskRights.Read, System.Security.AccessControl.AccessControlType.Allow));","sourceCodeStart":1463,"sourceCodeEnd":1499,"githubUrl":"https://github.com/peass-ng/PEASS-ng/blob/53fb989abc2219826385683a6fee826bd6cd38d6/winPEAS/winPEASexe/winPEAS/TaskScheduler/Task.cs#L1463-L1499","documentation":"RunEx documents that on systems earlier than Windows 10, any single parameter longer than 260 characters (the MAX_PATH-era limit) is rejected. This is a documented platform restriction on parameter length for pre-Win10 task execution, with the over-long parameter string as the at-fault input.","triggerScenarios":"Calling task.RunEx(...) with any parameter string of length >= 260 while TaskService.HighestSupportedVersion < TaskServiceVersion.V1_5.","commonSituations":"Long file paths or long inline arguments on Windows 7/8 or a down-level remote target; embedding config data as a task parameter.","solutions":["Keep each parameter under 260 characters","Persist long data to a temp file and pass its (short) path instead","Only call RunEx with long parameters on Windows 10+ (Task Scheduler 1.5+)","Pre-check TaskService.HighestSupportedVersion and branch your logic"],"exampleFix":"// before\ntask.RunEx(flags, 0, user, veryLongArg);\n// after\nif (Environment.OSVersion.Version >= new Version(10, 0) || veryLongArg.Length < 260)\n    task.RunEx(flags, 0, user, veryLongArg);\nelse\n    task.RunEx(flags, 0, user, WriteToTempFile(veryLongArg));","handlingStrategy":"validation","validationCode":"if (TaskService.HighestSupportedVersion < TaskServiceVersion.V1_5 &&\n    parameters.Any(p => p?.Length >= 260))\n    throw new ArgumentException(\"Parameter >= 260 chars not supported pre-Win10\");","typeGuard":null,"tryCatchPattern":"try { task.RunEx(flags, sid, user, parameters); }\ncatch (ArgumentOutOfRangeException) { /* fallback: temp-file strategy */ }","preventionTips":["Pre-check OS/version before using long parameters","Pass long payloads via temp files with short paths"],"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"}