Jump to content

Recommended Posts

Server config :win2k3/apache/PHP 5.2.1

 

if i login via remote control and run this command in a prompt

schtasks /create /tn mytask01 /tr c:\taskas.bat /sc once /st 16:32:00 /sd 10/19/2007 /ru MyDomaine\myusername /rp mypassword

A task will be created and run properly.

 

but if i tried via PHP using the following 2 different options a task is created but the password is not set in the task.

So the task will failed to run.

 

$echos = shell_exec("schtasks /create /tn mytask01 /tr c:\taskas.bat /sc once /st 16:32:00 /sd 10/19/2007 /ru MyDomaine\myusername /rp mypassword");

i get the following error in apache log:

WARNING: The scheduled task "mytask01" has been created, but may not run because the account information could not be set.

 

 

 

$runCommand = "schtasks /create /tn mytask01 /tr c:\taskas.bat /sc once /st 16:32:00 /sd 10/19/2007 /ru MyDomaine\myusername /rp mypassword";
$WshShell = new COM("WScript.Shell");
$output = $WshShell->Exec($runCommand)->StdOut->ReadAll;

 

I don't get any errors log in apache

 

For troubleshooting :

-I tried to run the apache service as locale admin account or domain admin account. (still doesn't fix the pbm).

-tried different syntax (found in google).(no better)

 

Link to comment
https://forums.phpfreaks.com/topic/74339-solved-shell_exec-schtasks-password/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.