Hello,
Depending on your needs, there are a few possible solutions you can try:
- You can create a batch task in Task Scheduler, using the .net use command to map network drives. This allows the task to access the network drive even if the user is not logged in. The first thing you need to do is make sure that the server's network settings allow it.
(1) Create a .bat batch file (e.g., NetworkDrive.bat) with the following contents:
@echo off
net use X: \your-network-path\shared-folder /persistent:yes /user:your-username your-password
(2) Create a new task in the task scheduler:
Trigger: Set to trigger every day, and the time is adjusted according to your needs.
Operation: Select "Start Program", set the program path to cmd.exe, and set the parameter '/c "D:\MapNetworkDrive.bat/c "D:\NetworkDrive.bat" (assuming the batch file is saved in the D:\ directory).
Condition: Set as needed.
Settings: Make sure that "Run regardless of whether the user is logged in or not" is checked.
- If the task needs to access an Azure file share, you can mount the Azure file share directly to an on-premises server. This avoids problems with network drive mapping.
- If the task can be implemented using a PowerShell script, you can access the network path directly in the script without mapping the network drives.
I hope this information helps.
Best regards,
Jingjing Wu