1

I have multiple batch files containing lines like

"schtasks.exe /create /tn NAME /tr \"cmd.exe /C \\\"start iexplore\\\"\" /sc once /st 03:05:43 /sd 12/18/2011"

and I would like to have my PHP file execute the batch file and thus schedule the multiple task..

exec("C:\\Wamp\\www\\batch\\$this->name.bat")

doesn't work and neither does

exec("cmd /K \"C:\\Wamp\\www\\batch\\123.bat\"")

works

The commands in the batch is inserted to the cmd but not executed.

But this is not the major problem..

When i try to simply

shell_exec("schtasks /create /tn NAME /tr \"cmd.exe /C \\\"start iexplore\\\"\" /sc once /st 03:05:43 /sd 12/21/2011");

in the apache log, it has

"ERROR: No mapping between account names and security IDs was done."

From other threads I figure this is permission problem, but I have no idea how to solve this.

EDIT: I am sure the schtask command is working fine. I echo the command, put it in the command prompt on the machine manually, and it works fine

AbSoLution8
  • 1,203
  • 1
  • 18
  • 27
  • 1
    Check that the account that Apache is running under has permissions to execute the batch file, and schedule tasks. Chances are it doesn't. – DaveRandom Dec 20 '11 at 16:10
  • thanks. but I am a total newbie on running servers. How do i do that? I can only find information to do that on unix. thanks. from httpd.conf i see user is set to daemon. How do I verify/set permission to schtask.exe? – AbSoLution8 Dec 20 '11 at 16:46
  • 1
    You need to go into Control Panel -> Administrative Tools -> Services, find the Apache service, and look at the user account in there. Chances are it will be SYSTEM, but standard(ish) practice would be to create a user specifically for Apache to use, to which you can then assign whatever permissions are required. To be honest, you might be better asking that kind of question over at http://serverfault.com/ – DaveRandom Dec 20 '11 at 17:03

0 Answers0