14988

Question:
I am trying to run a batch file from php with exec() but it is not working. When I run the same script in a command window in admin mode the script works.
Now I want to know how can I configure in php that my script can be execute with ADMIN mode.
Answer1:You can use <a href="http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/runas.mspx?mfr=true" rel="nofollow">RunAs Command</a>. Since it will ask admin password and you are running it from web you should pipe the admin password to the command.
exec('echo adminpassword | runas /user:administrator fullPathToProgram',$output);
print_r($output);