By default, PHP runs under the IUSR account . When executed directly:
$lastline = exec('D:\\MyProgram.exe', $output, $return_var);
It is running, but the program cannot perform tasks due to insufficient privileges. My question is: How to run an executable file under a Windows account from a PHP site?
I tried:
Run through Sysinternals PsExec :
$lastline = exec('D:\\PsExec.exe -u UserName -p Password -accepteula "D:\\MyProgram.exe"', $output, $return_var);
MyProgram.exe is not even running at all. PHP returns empty output, and return_var returns -1073741502. I assume this is some kind of unhandled exception.
Running through lsrunas :
$lastline = exec('D:\\lsrunas.exe /user:UserName /password:Password /domain:DOMAIN /command:"D:\\MyProgram.exe" /runpath:D:\\', $output, $return_var);
MyProgram.exe is also not running. PHP returns empty output, and return_var returns 0.
Microsoft runas , .
PHP, shell_exec, system passthru
IIS, - LOCAL SERVICE, SYSTEM .
EDIT: , . , , Load User Profile ( 3 ).
- ?
. .