Win7 scheduled task ignoring net use saved credentials

2

On Win7 64 Pro, I have a batch file that runs net use to map a network share from my server over OpenVPN.

The batch file doesn't have the username or password stored in it, it uses the user credentials that I have already saved by running net use once with the /savecred flag in a command prompt.

If I double click the batch file to run it, it executes fine, no problems.

However, if I schedule a task to run the batch file, the execution pauses and asks for username and password.

Is there any way to force the scheduled task to use the saved user credentials?

damndaewoo

Posted 2015-06-09T00:21:38.867

Reputation: 121

Answers

0

To solve this issue I ended up putting the batch file into the startup folder of the start menu. For some reason it uses the saved credentials when run from here but doesn't when run on startup with the task scheduler.

To make sure the VPN connection was up before running the batch file I used timeout 30 to delay execution of the batch file until OpenVPN had done its thing.

damndaewoo

Posted 2015-06-09T00:21:38.867

Reputation: 121