When saving an environment, I get the message…
The environment was saved successfully, but the required Task Scheduler task could not be created
It seems to save the selected environment settings but it does not create the Task Scheduler task, meaning that the sync process will never run because the required task is missing.
When saving an environment, the app will attempt to create a task in Task Scheduler using the security context the app was started with (usually the logged-in user).
Furthermore, the app will attempt to create the task so that when it runs, the maximum allowed security is used for executing the sync process.
The process tries each one of these options for the “When running the task, use the following user account” setting:
- Use the SYSTEM account to run the sync process
- Use the NETWORK SERVICE account to run the sync process
- Use the Windows account that was provided for the Active Directory connection to run the sync process
- Use the signed-in user account to run the sync process
The app may have been previously started with an elevated security context using “run as administrator” and therefore the task was created using that elevated security context (SYSTEM or NETWORK SERVICE). This results in a task that can only be viewed in Task Scheduler if Task Scheduler is started using the same elevated security context as “run as administrator”
Later on, if the app is started with a lower security context and an environment is saved, the apps security context does not have access to modify the previously created task which is now tied to the elevated security context, resulting in an orphan task that can only be modified if the app is once again started using the elevated security context.
Furthermore, you can inspect the C:\ConnectToADData\logs\task-scheduler-? file for a detailed log of the process that creates the required task to check for issues.