Forum Discussion
Windows Server 2022 Scheduled Task issue
We are experiencing some of the same strange behaviours when migrating scheduled tasks from server 2012r2/2016/2019 to server 2022. All patched with july 22 updates.
One Example:
We have a small powershell script connecting to a sql-database and exporting the results from a query to a .csv file. When we run the task on server 2012r2/2016/2019 with a service account in the domain the task is connecting to the db and presenting a .csv-file with the results. (we replicated this on three 2022 servers, none of which worked. and several 2016 and 2012 r2 servers are all working fine)
When we try the task on server 2022 we get this error in our logs:
invoke-sqlcmd : Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'.
the scheduled task is running as a domain user and we exported/imported the task on all the test-servers. When we login to the server as the domain service account and run the script manually it works on the 2022 servers.
It works if we select "only run when the user is logged on", but as soon as we change to "run whether the user is logged on or not" we get the same error as above.
Current workaround is running the task as "LOCAL SYSTEM" and granting the computer object access to the path where the .csv file is to be produced.