{"record":{"id":"fd32f5ce5f6f69ed","repo":"peass-ng/PEASS-ng","slug":"a-password-cannot-be-supplied-when-specifying-task-fd32f5","errorCode":null,"errorMessage":"A password cannot be supplied when specifying TaskLogonType.Group.","messagePattern":"A password cannot be supplied when specifying TaskLogonType\\.Group\\.","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"winPEAS/winPEASexe/winPEAS/TaskScheduler/TaskFolder.cs","lineNumber":506,"sourceCode":"            User user = new User(userId);\n            if (v2Folder != null)\n            {\n                definition.Actions.ConvertUnsupportedActions();\n                if (logonType == TaskLogonType.ServiceAccount)\n                {\n                    if (string.IsNullOrEmpty(userId) || !user.IsServiceAccount)\n                        throw new ArgumentException(@\"A valid system account name must be supplied for TaskLogonType.ServiceAccount. Valid entries are \"\"NT AUTHORITY\\SYSTEM\"\", \"\"SYSTEM\"\", \"\"NT AUTHORITY\\LOCALSERVICE\"\", or \"\"NT AUTHORITY\\NETWORKSERVICE\"\".\", nameof(userId));\n                    if (password != null)\n                        throw new ArgumentException(@\"A password cannot be supplied when specifying TaskLogonType.ServiceAccount.\", nameof(password));\n                }\n                /*else if ((LogonType == TaskLogonType.Password || LogonType == TaskLogonType.InteractiveTokenOrPassword ||\n\t\t\t\t\t(LogonType == TaskLogonType.S4U && UserId != null && !user.IsCurrent)) && password == null)\n\t\t\t\t{\n\t\t\t\t\tthrow new ArgumentException(\"A password must be supplied when specifying TaskLogonType.Password or TaskLogonType.InteractiveTokenOrPassword or TaskLogonType.S4U from another account.\", nameof(password));\n\t\t\t\t}*/\n                else if (logonType == TaskLogonType.Group && password != null)\n                {\n                    throw new ArgumentException(@\"A password cannot be supplied when specifying TaskLogonType.Group.\", nameof(password));\n                }\n                // The following line compensates for an omission in the native library that never actually sets the registration date (thanks ixm7).\n                if (definition.RegistrationInfo.Date == DateTime.MinValue) definition.RegistrationInfo.Date = DateTime.Now;\n                var iRegTask = v2Folder.RegisterTaskDefinition(path, definition.v2Def, (int)createType, userId ?? user.Name, password, logonType, sddl);\n                if (createType == TaskCreation.ValidateOnly && iRegTask == null)\n                    return null;\n                return Task.CreateTask(TaskService, iRegTask);\n            }\n\n            // Check for V1 invalid task names\n            string invChars = Regex.Escape(new string(System.IO.Path.GetInvalidFileNameChars()));\n            if (Regex.IsMatch(path, @\"[\" + invChars + @\"]\"))\n                throw new ArgumentOutOfRangeException(nameof(path), @\"Task names may not include any characters which are invalid for file names.\");\n            if (Regex.IsMatch(path, @\"\\.[^\" + invChars + @\"]{0,3}\\z\"))\n                throw new ArgumentOutOfRangeException(nameof(path), @\"Task names ending with a period followed by three or fewer characters cannot be retrieved due to a bug in the native library.\");\n\n            // Adds ability to set a password for a V1 task. Provided by Arcao.\n            TaskFlags flags = definition.v1Task.GetFlags();","sourceCodeStart":488,"sourceCodeEnd":524,"githubUrl":"https://github.com/peass-ng/PEASS-ng/blob/53fb989abc2219826385683a6fee826bd6cd38d6/winPEAS/winPEASexe/winPEAS/TaskScheduler/TaskFolder.cs#L488-L524","documentation":"Argument-validation guard in RegisterTaskDefinition: it fires when a non-null password is supplied while logonType is TaskLogonType.Group. Group logon runs under the group identity with no individual credential, so any password value indicates mismatched arguments from the caller.","triggerScenarios":"Thrown at winPEAS/winPEASexe/winPEAS/TaskScheduler/TaskFolder.cs:506 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass null for the password parameter when using TaskLogonType.Group","Choose TaskLogonType.Password or TaskLogonType.InteractiveTokenOrPassword when per-user credentials must be supplied"],"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"}