{"record":{"id":"6627d0ae981ad26a","repo":"peass-ng/PEASS-ng","slug":"a-maximum-of-32-actions-is-allowed-within-a-single-6627d0","errorCode":null,"errorMessage":"A maximum of 32 actions is allowed within a single task.","messagePattern":"A maximum of 32 actions is allowed within a single task\\.","errorType":"exception","errorClass":"ArgumentOutOfRangeException","httpStatus":null,"severity":"error","filePath":"winPEAS/winPEASexe/winPEAS/TaskScheduler/ActionCollection.cs","lineNumber":322,"sourceCode":"        /// <summary>Adds an <see cref=\"Action.ExecAction\"/> to the task.</summary>\n        /// <param name=\"path\">Path to an executable file.</param>\n        /// <param name=\"arguments\">Arguments associated with the command-line operation. This value can be null.</param>\n        /// <param name=\"workingDirectory\">\n        /// Directory that contains either the executable file or the files that are used by the executable file. This value can be null.\n        /// </param>\n        /// <returns>The bound <see cref=\"Action.ExecAction\"/> that was added to the collection.</returns>\n        [NotNull]\n        public Action.ExecAction Add([NotNull] string path, [CanBeNull] string arguments = null, [CanBeNull] string workingDirectory = null) =>\n            Add(new Action.ExecAction(path, arguments, workingDirectory));\n\n        /// <summary>Adds a new <see cref=\"Action\"/> instance to the task.</summary>\n        /// <param name=\"actionType\">Type of task to be created</param>\n        /// <returns>Specialized <see cref=\"Action\"/> instance.</returns>\n        [NotNull]\n        public Action AddNew(TaskActionType actionType)\n        {\n            if (Count >= MaxActions)\n                throw new ArgumentOutOfRangeException(nameof(actionType), \"A maximum of 32 actions is allowed within a single task.\");\n            if (v1Task != null)\n            {\n                if (!SupportV1Conversion && (v1Actions.Count >= 1 || actionType != TaskActionType.Execute))\n                    throw new NotV1SupportedException($\"Only a single {nameof(Action.ExecAction)} is supported unless the {nameof(PowerShellConversion)} property includes the {nameof(PowerShellActionPlatformOption.Version1)} value.\");\n                return Action.CreateAction(v1Task);\n            }\n            return Action.CreateAction(v2Coll.Create(actionType));\n        }\n\n        /// <summary>Adds a collection of actions to the end of the <see cref=\"ActionCollection\"/>.</summary>\n        /// <param name=\"actions\">\n        /// The actions to be added to the end of the <see cref=\"ActionCollection\"/>. The collection itself cannot be <c>null</c> and cannot\n        /// contain <c>null</c> elements.\n        /// </param>\n        /// <exception cref=\"ArgumentNullException\"><paramref name=\"actions\"/> is <c>null</c>.</exception>\n        public void AddRange([ItemNotNull, NotNull] IEnumerable<Action> actions)\n        {\n            if (actions == null)","sourceCodeStart":304,"sourceCodeEnd":340,"githubUrl":"https://github.com/peass-ng/PEASS-ng/blob/53fb989abc2219826385683a6fee826bd6cd38d6/winPEAS/winPEASexe/winPEAS/TaskScheduler/ActionCollection.cs#L304-L340","documentation":"A capacity guard in TaskScheduler ActionCollection.AddNew (and related Add paths): the Windows Task Scheduler COM API (IActionCollection) supports at most 32 actions per task, so adding another bound action beyond that limit is rejected before the COM call. It fires when a task definition is programmatically built with more than 32 actions.","triggerScenarios":"Thrown at winPEAS/winPEASexe/winPEAS/TaskScheduler/ActionCollection.cs:322 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Consolidate actions — wrap multiple commands in a single script/exec action","Check ActionCollection.Count before adding and split into multiple tasks when approaching 32","Prune obsolete actions from the definition before adding new ones"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"53fb989abc2219826385683a6fee826bd6cd38d6","analyzedAt":"2026-09-02T04:25:09.259Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T11:17:12.671Z"}