Goodmorning everyone, I'm a newbie Windows 2008 s.a., and I'm stuck with a strange problem.
I've made a very simple bat file that stops the Apache HTTP Server, copies a file and then restart the webserver (yes, this is stupid, but this is what they gave to me). Now, the bat runs properly, but if I schedule it, no matter of what privileges I give to the process, it simply doesn't run.
Just to be sure, I've made another script that should create a directory and again it runs normally, but not as a scheduled task.
Where am I wrong? Thank you.
try to run the batch with error redirecting in task scheduler example.bat 2>>c:\Folder\Errors.txt >>c:\Folder\Run.txt
and change the batchfile, so you get an output everytime (add two lines)
If you only get one line in both files, your batch has no output, but is running If you get no output in both files, more permissions are needed...
btw did you click on "Run with highest privileges" and "Run whether user is logged on or not" in the task scheduler library?
What is the run result in the task scheduler? Does it state (0x0)?
In the action tab what did you enter in "program/script" and what in "arguments" and what in "Start in"?
Usually a batch file should be started using cscript.exe and the file is the argument.
Also, as you are on a Windows 2008 R2 server I would recommend using powershell instead of batchfiles.
I solved the matter.
The scripts come from a Windows 2003 Web Edition OS, and they were executed "in the same directory" where they were, seems that in 2008 R2 they're runned in the system32 directory, so I had to use absolute paths.
Everything gone fixed now, thank you for the advices anyway.