How to Give only Group permission.

Kanhaiyalal Chandrawanshi 40 Reputation points
2025-09-12T11:44:07.71+00:00

Hello Team,

I have a problem with the task scheduler running on 'Microsoft Windows Server 2022 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 Domain 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.

Any suggestions or best practices you can share to achieve this setup would be greatly appreciated.

Thanks and regards.

Kanhaiya Lal Chandrawanshi.

Windows for business | Windows Server | Directory services | Active Directory
0 comments No comments

Answer accepted by question author
Domic Vo 37,000 Reputation points Independent Advisor
2025-09-12T12:42:41.5966667+00:00

Dear Mr. Chandrawanshi,

Thank you for reaching out. We understand you're experiencing an issue with Task Scheduler on Windows Server 2022 Datacenter, where a batch file intended to copy files from an Azure file share works manually and when the user is logged on, but fails silently when set to run regardless of login status.

This behavior is often related to network drive access and user context limitations. When using the “Run whether user is logged on or not” option, the task runs in a non-interactive session, which may not have access to mounted network shares—even with domain admin credentials.

To resolve this, we recommend the following best practices:

Use UNC paths (e.g., \\storageaccount\sharename) instead of mapped drives in your batch file.

Ensure the task is set to “Run with highest privileges”.

Confirm that the domain account has explicit permissions to access both source and destination folders.

If the Azure file share requires authentication, consider embedding credential handling in the script using net use with secure credential storage.

I hope this helps. Just kindly tick Accept Answer that others in the community facing similar issues can easily find the solution. Your contribution is highly appreciated.

Best regards,

Domic Vo

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.