Problems with exec and psexec
Posted: Wed Jan 19, 2011 11:38 am
Hi,
I'm having a big problem using the exec() function. I want to execute a remote cacls to view and parse the returned accesslist. I use PsExec from SysInternals, and it's a Windows environment (and active directory) with apache. The problem is this:
Making some tests, I have checked thar the following line works:
$comando = 'psexec \\\\'.$_CONFIG['equipoRemotoPsExec'].' -u '.$_CONFIG['userPsExec'].' -p '.$_CONFIG['passwdPsExec'].' -accepteula cacls "C:\\Install\\SUPPORT"';
exec ($comando, $arr );
and it returns the accesslist.
(psexec \\remote address -u user -p password -accepteula command)
But the remote folder must be a parameter (variable) and after spending too many hours, I`ve checked that if the destination folder parameter has some spaces, it won't work (and it could happen):
$comando = 'psexec \\\\'.$_CONFIG['equipoRemotoPsExec'].' -u '.$_CONFIG['userPsExec'].' -p '.$_CONFIG['passwdPsExec'].' -accepteula cacls "C:\\Documents and Settings\\All Users\\Desktop"';
exec ($comando, $arr);
Any suggestions or ideas? Has someone have this problem too?
Thak you very much and sorry about my english,
Juan
I'm having a big problem using the exec() function. I want to execute a remote cacls to view and parse the returned accesslist. I use PsExec from SysInternals, and it's a Windows environment (and active directory) with apache. The problem is this:
Making some tests, I have checked thar the following line works:
$comando = 'psexec \\\\'.$_CONFIG['equipoRemotoPsExec'].' -u '.$_CONFIG['userPsExec'].' -p '.$_CONFIG['passwdPsExec'].' -accepteula cacls "C:\\Install\\SUPPORT"';
exec ($comando, $arr );
and it returns the accesslist.
(psexec \\remote address -u user -p password -accepteula command)
But the remote folder must be a parameter (variable) and after spending too many hours, I`ve checked that if the destination folder parameter has some spaces, it won't work (and it could happen):
$comando = 'psexec \\\\'.$_CONFIG['equipoRemotoPsExec'].' -u '.$_CONFIG['userPsExec'].' -p '.$_CONFIG['passwdPsExec'].' -accepteula cacls "C:\\Documents and Settings\\All Users\\Desktop"';
exec ($comando, $arr);
Any suggestions or ideas? Has someone have this problem too?
Thak you very much and sorry about my english,
Juan