1

I was an ace with Windows 2003 Scheduled Tasks. Everything just worked. This does not seem to be the case with the 2008 Task Scheduler. I need it to run a batch file that calls osql.exe and then copies a newly created file to a network share. Therefore, the task needs to have the password stored so that it can access remote resources. So I let it save the password. I also went into the local security policy and added the user to "task requires that the user account has log on as batch job" permission. If I do:

runas /user:mydomain\myser cmd

then run the batch file, it works every time. If I try to run it from the GUI it will not run, even though it says "Running" in the Status column. The user account I use is a Domain User and nothing more. For the Actions tab, I have the program starting in the directory where the batch file exists.

Any ideas? Does anyone else struggle with this?

2
  • Did you check the event logs for a specific error we can work with?
    – Chris S
    Jul 13, 2010 at 19:23
  • The only 2 entries in the Event Viewer are under Security - "Audit Success". These occur when the batch file is started from Task Scheduler.
    – jftuga
    Jul 13, 2010 at 21:08

4 Answers 4

2

Try psexec'ing into the server as the user and running the batch file. You will then likely see the error.

I had a similar problem with batch file running normally but not with 08 R2 Task Scheduler. It would run if "Only run when user logged in", but not when "Run whether user is logged on or not".

Turned out something was trying to access drives by drive letter. I'm not sure if this was programmed directly or 08 was trying to be smart and converting the UNC path to a mapped drive. My ini file for the program only had UNC paths though. Obviously drive letters aren't mapped when user not logged on..

I ended up having to map the drive in the batch file with credentials (it doesn't pass through). It then worked.

This may or may not be a similar issue to you.

1

Make sure the user running the tasks has premissions to the batch file and any network shares. Then pick "Run whether user is logged on or not" and checking the "Run with highest privileges" checkbox on the General tab.

0

Start - Administrative Tools -Local Security Policy - Local Policies - Security Options - "Network access: Do not llow storage of passwords and credentials for network authentication" -disabled by default, switch to enabled.

1
  • This did not work. In fact I think it is going in the opposite direction as the batch file needs to copy a file over the network.
    – jftuga
    Oct 26, 2010 at 12:55
0

Make a .bat file in your exe' s directory. In first line change to the directory of your exe. In the second line call your exe like this:

pushd "%~dp0"

YourExe.exe

In the task scheduler do not call your exe but call your bat file

2
  • Please read the serverfault FAQ: serverfault.com/FAQ. SF is a Question & Answer sight, so answers should stay on target to answering the original posters question. You're more than welcome to ask your question on it's own. Once you get enough rep, you can also use the commenting facility which is under both the questions & answers for the type of feedback that you're posting in your answer.
    – slm
    Mar 12, 2013 at 16:05
  • Agreed, and I've edited the answer accordingly.
    – MadHatter
    Mar 12, 2013 at 16:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .