peass-ng/PEASS-ng · error · ArgumentException
A password cannot be supplied when specifying TaskLogonType.
Error message
A password cannot be supplied when specifying TaskLogonType.Group.
What it means
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.
Source
Thrown at winPEAS/winPEASexe/winPEAS/TaskScheduler/TaskFolder.cs:506
User user = new User(userId);
if (v2Folder != null)
{
definition.Actions.ConvertUnsupportedActions();
if (logonType == TaskLogonType.ServiceAccount)
{
if (string.IsNullOrEmpty(userId) || !user.IsServiceAccount)
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));
if (password != null)
throw new ArgumentException(@"A password cannot be supplied when specifying TaskLogonType.ServiceAccount.", nameof(password));
}
/*else if ((LogonType == TaskLogonType.Password || LogonType == TaskLogonType.InteractiveTokenOrPassword ||
(LogonType == TaskLogonType.S4U && UserId != null && !user.IsCurrent)) && password == null)
{
throw new ArgumentException("A password must be supplied when specifying TaskLogonType.Password or TaskLogonType.InteractiveTokenOrPassword or TaskLogonType.S4U from another account.", nameof(password));
}*/
else if (logonType == TaskLogonType.Group && password != null)
{
throw new ArgumentException(@"A password cannot be supplied when specifying TaskLogonType.Group.", nameof(password));
}
// The following line compensates for an omission in the native library that never actually sets the registration date (thanks ixm7).
if (definition.RegistrationInfo.Date == DateTime.MinValue) definition.RegistrationInfo.Date = DateTime.Now;
var iRegTask = v2Folder.RegisterTaskDefinition(path, definition.v2Def, (int)createType, userId ?? user.Name, password, logonType, sddl);
if (createType == TaskCreation.ValidateOnly && iRegTask == null)
return null;
return Task.CreateTask(TaskService, iRegTask);
}
// Check for V1 invalid task names
string invChars = Regex.Escape(new string(System.IO.Path.GetInvalidFileNameChars()));
if (Regex.IsMatch(path, @"[" + invChars + @"]"))
throw new ArgumentOutOfRangeException(nameof(path), @"Task names may not include any characters which are invalid for file names.");
if (Regex.IsMatch(path, @"\.[^" + invChars + @"]{0,3}\z"))
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.");
// Adds ability to set a password for a V1 task. Provided by Arcao.
TaskFlags flags = definition.v1Task.GetFlags();View on GitHub (pinned to 53fb989abc)
Solutions
- Pass null for the password parameter when using TaskLogonType.Group
- Choose TaskLogonType.Password or TaskLogonType.InteractiveTokenOrPassword when per-user credentials must be supplied
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at winPEAS/winPEASexe/winPEAS/TaskScheduler/TaskFolder.cs:506 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of peass-ng/PEASS-ng@53fb989abc (2026-09-02).
Data as JSON: /api/errors/fd32f5ce5f6f69ed.
Report an issue: GitHub.