Having problems with Psexec on WS 2008


this has been doing my head in for a while, so I thought it might be a stupid little thing I’m missing. Basically I want to start a desktop application from PHP on my Windows Server 2008 with a Wamp configuration installed. My Apache service is allowed to interact with desktop applications.
So here’s what I’m doing:

exec("psexec -s -d application.exe", $back); 

The above code works on my local PC. Doesn’t on the server. I have tried with the path of the files:

exec("psexec -s -d C:\\path\\of\\file\\application.exe", $back); 

exec("C:\\path\\of\\file\\psexec.exe -s -d C:\\path\\of\\file\\application.exe", $back); 

I have tried with two backslashes.

exec("C:\\\\path\\\\of\\\\file\\\\psexec.exe -s -d C:\\\\path\\\\of\\\\file\\\\application.exe", $back); 

I have tried most of the stuff I could think about, or that I found by searching the Web, but nothing has solved this problem yet.
I’m really hoping one of you will know and sort me out!

Thank you.

If you’re trying to fire off an application that will run asynchronously, maybe you could make a batch file on the server that starts the application, then use php to run the batch file rather than the application itself.

Just a wild guess!

Not a stupid guess though! The problem is that I am also passing command line arguments to the application, I don’t think I could achieve this that way. I would need to generate the batch from PHP too :slight_smile: