In my case I cannot run even with local user account with task option "Run whether user is logged on or not"
Task scheduler - does not work with the option 'Run whether user is logged on or not.'
I have a problem with the task scheduler running on 'Microsoft Windows Server 2019 Datacenter'. I tried to configure a task scheduler to run a batch file to copy a file from a folder (Azure file share folder mounted on the server) to another folder (present in the server). I'm using local admin account to login and schedule the task. The Batch file as administrator rights.
When I run the batch file manually, it works fine. The task scheduler runs fine with the option 'Run only when user is logged on'. But it fails to execute the batch file with the option 'Run whether user is logged on or not.'
When the task scheduler runs with the option 'Run whether user is logged on or not, it shows that the task finished successfully.
Schedular Log -
Task Scheduler successfully finished "{aacb1a31-c097-408e-8d46-c380ce95d7e8}" instance of the "\TEST-AUTOMATION" task for user "AZ-PSMB24\sysadmin".
Windows for business Windows Server User experience Remote desktop services and terminal services
Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question. To protect privacy, user profiles for migrated questions are anonymized.
32 answers
Sort by: Most helpful
-
Anonymous
2024-05-13T06:03:48+00:00 -
Anonymous
2024-09-18T05:18:22+00:00 For me is still not working.
-
Anonymous
2024-02-07T02:15:58+00:00 Hello Surajit Biswas1,
Thank you for posting in Microsoft Community forum.
Based on the information you provided, it seems that the issue might be related to the user account that is being used to run the task. When you select the option "Run whether user is logged on or not," the task scheduler runs the task under the security context of the user account that you specify in the task properties.
In this case, it's possible that the user account you're using does not have the necessary permissions to access the Azure file share folder or the destination folder on the server. You might need to grant the user account the necessary permissions to access those folders.
You can also try running the task with the option "Run with highest privileges" to see if that resolves the issue. This option allows the task to run with administrator privileges, which might be necessary for the task to complete successfully.
Based on the log you provided, it seems that the task completed successfully when run with the option "Run whether user is logged on or not." However, you mentioned that the batch file did not actually execute when the task was run with this option.
It's possible that the task completed successfully because the task scheduler was able to start the batch file, but the batch file itself encountered an error or did not execute as expected. You might want to check the batch file to see if there are any issues that might be causing it to fail when run in this context.
Another possibility is that the task is running under a different user context when run with the option "Run whether user is logged on or not." In this case, the batch file might be encountering issues because it is not able to access resources that are available when the user is logged on. You might need to modify the batch file to account for this difference in context, or modify the task to run only when the user is logged on.
Also you can try creating a new user account with the necessary permissions to access the Azure file share folder and use that account to run the task.
I hope the information above is helpful.
If you have any question or concern, please feel free to let us know.
Best Regards,
Haijian Shan
-
Anonymous
2024-02-16T13:39:46+00:00 Hello Haijian,
Thanks for the reply.
I have tried all the solutions that you suggested but we are not able to solve the issue. Let me mention that systematically.
- This 'sysadmin' user has access to the Azure File Share Folder. And it can successfully transfer the file when the schedular is run using 'Run only when user is logged on'.
- I have tried to run the schedular with "Run with highest privileges", but it didn't work.
- As you mentioned, I checked the batch file for an error for the context 'Run whether user is logged on or not' but there was no error for the batch file.
- Testing the schedular by creating another user is pending. But based on our production scenario, this option is our last resort.
Please let me know if we have any other ways to troubleshoot this issue.
Thanks & Regards,
Surajit Biswas
-
Anonymous
2024-02-19T08:04:52+00:00 hi Surajit Biswas1,
Based on the information you provided, it seems that the issue might be related to the way the Azure file share folder is being accessed. When you run the batch file manually, you are likely accessing the folder using your own credentials, which might be different from the credentials being used when the task is run with the option "Run whether user is logged on or not."
One possible solution is to modify the permissions on the Azure file share folder to grant the user account being used to run the task the necessary permissions to access the folder. You can do this by logging in to the Azure portal and modifying the permissions on the folder.
Judging from the current situation the question is related to Azure.
Since there are no engineers dedicated to Azure in this forum. in order to be able to get a quick and effective handling of your issue, I recommend that you repost your question in the Q&A forum, where there will be a dedicated engineer to give you a professional and effective reply.
Here is the link for Q&A forum.
Click the "Ask a Question" button in the upper right corner to post your question and select "Azure" tag and any other tags related to your productions.
Best Regards,
Haijian Shan