Task Scheduling

Anonymous
2025-02-06T18:57:55+00:00

Hello,

I have windows server hosted on azure. There are task which are triggered every day at different time, however the user logged into the server via RDP gets signed off after 24hours, it is a GPO in domain environment by our security team. I want to run those jobs, even if the user is not logged in, I know I can do this in Task Scheduler, with the option "Run whether user is logged on or not", but the issue here is that, jobs I have to run require network drive access, and I think that doing this with Task Scheduler does not have access to network drive in non-interactive session. Is there any solution or another approach.

Thanks

Regards,

Rijens

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.

0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Anonymous
    2025-02-07T14:23:16+00:00

    Hello,

    Depending on your needs, there are a few possible solutions you can try:

    1. 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.

    1. 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.
    2. 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

    0 comments No comments