{"record":{"id":"a7bfed018c962c64","repo":"peass-ng/PEASS-ng","slug":"task-names-ending-with-a-period-followed-by-three","errorCode":null,"errorMessage":"Task names ending with a period followed by three or fewer characters cannot be retrieved due to a bug in the native library.","messagePattern":"Task names ending with a period followed by three or fewer characters cannot be retrieved due to a bug in the native library\\.","errorType":"exception","errorClass":"ArgumentOutOfRangeException","httpStatus":null,"severity":"error","filePath":"winPEAS/winPEASexe/winPEAS/TaskScheduler/TaskFolder.cs","lineNumber":521,"sourceCode":"\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();\n            if (logonType == TaskLogonType.InteractiveTokenOrPassword && string.IsNullOrEmpty(password))\n                logonType = TaskLogonType.InteractiveToken;\n            switch (logonType)\n            {\n                case TaskLogonType.Group:\n                case TaskLogonType.S4U:\n                case TaskLogonType.None:\n                    throw new NotV1SupportedException(\"This LogonType is not supported on Task Scheduler 1.0.\");\n                case TaskLogonType.InteractiveToken:\n                    flags |= (TaskFlags.RunOnlyIfLoggedOn | TaskFlags.Interactive);\n                    definition.v1Task.SetAccountInformation(user.Name, IntPtr.Zero);\n                    break;\n                case TaskLogonType.ServiceAccount:\n                    flags &= ~(TaskFlags.Interactive | TaskFlags.RunOnlyIfLoggedOn);\n                    definition.v1Task.SetAccountInformation((String.IsNullOrEmpty(userId) || user.IsSystem) ? String.Empty : user.Name, IntPtr.Zero);","sourceCodeStart":503,"sourceCodeEnd":539,"githubUrl":"https://github.com/peass-ng/PEASS-ng/blob/53fb989abc2219826385683a6fee826bd6cd38d6/winPEAS/winPEASexe/winPEAS/TaskScheduler/TaskFolder.cs#L503-L539","documentation":"Regex-based sentinel in RegisterTaskDefinition: it rejects task names that end in a period followed by up to three characters (pattern \\.[^invalid]{0,3}\\z). This is not arbitrary strictness — the native Task Scheduler 1.0 library cannot retrieve tasks with such names (the suffix collides with file-extension handling of the .job file), so registration is blocked to prevent an unretrievable task.","triggerScenarios":"Thrown at winPEAS/winPEASexe/winPEAS/TaskScheduler/TaskFolder.cs:521 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Rename the task so it does not end with a period followed by three or fewer characters (e.g. avoid names like 'task.abc' or 'task.')","Use names that end with four or more characters after any period, or contain no trailing period"],"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"}