Skip to content

Create Scheduled Task Error #2410

@andrewsauder

Description

@andrewsauder

Describe the bug
When running the "(Re)create scheduled task" command, wacs.exe fails to create the task and shows error "System.ArgumentException: Value does not fall within the expected range.".

To Reproduce

  1. Run wacs.exe
  2. Pick menu option O: More options...
  3. Pick menu option T: (Re)create scheduled task
  4. Press enter to skip entering a user the task will run as
  5. See error message

Expected behavior
Scheduled task should create successfully.

Log
Win-Acme Log

2023-07-27 08:26:57.204 -04:00 [INF] Adding Task Scheduler entry with the following settings
2023-07-27 08:26:57.205 -04:00 [INF] - Name E:/Win-Acme/config renew (acme-v02.api.letsencrypt.org)
2023-07-27 08:26:57.205 -04:00 [INF] - Path E:\Win-Acme\application
2023-07-27 08:26:57.206 -04:00 [INF] - Command wacs.exe --renew --baseuri "https://acme-v02.api.letsencrypt.org/"
2023-07-27 08:26:57.206 -04:00 [INF] - Start at "09:00:00"
2023-07-27 08:26:57.207 -04:00 [INF] - Random delay "04:00:00"
2023-07-27 08:26:57.207 -04:00 [INF] - Time limit "02:00:00"
2023-07-27 08:26:58.735 -04:00 [DBG] Creating task to run as system user
2023-07-27 08:26:58.742 -04:00 [ERR] Failed to create task
System.ArgumentException: Value does not fall within the expected range.
   at Microsoft.Win32.TaskScheduler.V2Interop.ITaskFolder.RegisterTaskDefinition(String Path, ITaskDefinition pDefinition, Int32 flags, Object UserId, Object password, TaskLogonType LogonType, Object sddl)
   at Microsoft.Win32.TaskScheduler.TaskFolder.RegisterTaskDefinition(String path, TaskDefinition definition, TaskCreation createType, String userId, String password, TaskLogonType logonType, String sddl)
   at PKISharp.WACS.Services.TaskSchedulerService.CreateTaskScheduler(RunLevel runLevel)

Windows Event Viewer Error

Failed to create task
System.ArgumentException: Value does not fall within the expected range.
   at Microsoft.Win32.TaskScheduler.V2Interop.ITaskFolder.RegisterTaskDefinition(String Path, ITaskDefinition pDefinition, Int32 flags, Object UserId, Object password, TaskLogonType LogonType, Object sddl)
   at Microsoft.Win32.TaskScheduler.TaskFolder.RegisterTaskDefinition(String path, TaskDefinition definition, TaskCreation createType, String userId, String password, TaskLogonType logonType, String sddl)
   at PKISharp.WACS.Services.TaskSchedulerService.CreateTaskScheduler(RunLevel runLevel)

Platform:

  • OS: Windows Server 2019 Datacenter Version 1809
  • Version: 2.2.5.1541 (release, pluggable, standalone, 64-bit)
  • Plugins: validation plugin Cloudflare

Additional context

  • Error occurs both when provided a specific user account to run the task as and when using the default "n" option
  • Error occurs with Carbon Black Defense (antivirus) enabled and disabled

Happy to provide additional context or details as needed. I'm a bit stumped on what I should try next.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions