Task Scheduler problem-Running bat files that writes to mapped drives

I tried running the bat file manually , it works OK. The bat file runs a java class which detects the folder exists , then write file to mapped drive(Z:/) , which has permissions enabled full control for Authenticated Users.

However, when I use Task Scheduler to run a bat file, it seems that it could not detect the path.

Would like to know how can I make task scheduler to run the bat file such that it can write files on mapped drive?

May 30th, 2013 4:10am

Does the batch file reference the drive letter or UNC path?  It is likely that the user account configured to run the task doesn't have the drive mapped.  You could utilise the 'net use' command inside the batch file to map the drive.  The syntax of this command is:

NET USE

[devicename | *] [\\computername\sharename[\volume] [password | *]]

        [/USER:[domainname\]username]

        [/USER:[dotted domain name\]username]

        [/USER:[username@dotted domain name]

        [/SMARTCARD]

        [/SAVECRED]

        [[/DELETE] | [/PERSISTENT:{YES | NO}]]

NET USE {devicename | *} [password | *] /HOME

NET USE [/PERSISTENT:{YES | NO}]

Or simply reference the UNC path in the batch file instead of a drive letter.


Free Windows Admin Tool Kit Click here and download it now
May 30th, 2013 10:55am

That still doesn't address the problems with running in the Task Scheduler. Everyone suggests 'NET USE', but apparently none bother to test their answers in a scheduled task. 'NET USE' simply does not solve this problem.

April 7th, 2014 3:22pm

I know it's been a while, Did you ever find a solution to your problem?

I'm running into the exact same issue. Scheduler runs by batch file fine when looking at a local directory but does not run when specifying a mapped drive.

Free Windows Admin Tool Kit Click here and download it now
March 6th, 2015 4:20pm

If your task is running as Local System, it will not be an Authenticated User as far as the remote file location is concerned. Check what account the task is running as, and check the permissions on the other end. A Local System account is not an Authenticated User. 
March 6th, 2015 4:31pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics