I believe this is the same as this question but no solution was provided.
I have a query which uses PSExec to do a net session ona profile server, and it works fine when put in from the command line like below:
psexec \\profile-server -u username -p password net session
It will show the PSExec banner (from stderr) and then the query results (from stdout).
However, when I run this from PHP I can only see the stderr feed (both when sending to the screen or to file) but can't see stdout at all. When I redirect stdout to a file the file is blank.
Here is the PHP:
<?php
$uname_prof = "DOMAIN-USERNAME";
$pw_prof = "DOMAIN-PASSWORD";
$ip = "PROFILE-SERVER";
$query = "psexec.exe \\\\$ip -u $uname_prof -p $pw_prof net session";
$result = exec($query, $output);
echo implode('<br>', $output);
?>
Thanks!