Page 1 of 1

Identifications with PSExec

Posted: Wed Apr 12, 2017 12:56 am
by jbeeson
I'm attempting to use PSExec to execute my automated tests remotely. I use it to launch a powershell script that has the ranorex command line execution. The issue is that it won't identify anything once the app under test launches. When I use studio or run the powershell script locally on the remote machine it runs fine. Any suggestions would be appreciated.

Here's the PSExec command:

Code: Select all

c:\pstools\psexec \\[remote machine] -u [user] -p [password] -h -w "c:\test\exe\dir" -i 1 cmd /c "powershell c:\test\exe\dir\smoketest.ps1" -accepteula
And here's the content of smoketest.ps1:

Code: Select all

# Run Smoke Test
$testRoot =  "c:\test\exe\dir"
Start-Process -FilePath "$testRoot\SmokeTest\SmokeTest\bin\Debug\SmokeTest.exe" -ArgumentList "/zr /rf:$testRoot/TestResults/SmokeTest." -WorkingDirectory "$testRoot\SmokeTest\SmokeTest\bin\Debug" -Wait -Verb runAs

Re: Identifications with PSExec

Posted: Wed Apr 12, 2017 7:15 am
by odklizec
Hi,

Is there any particular reason why you are using powershell script to start the test exe? Why don't you start it directly from psexec, like this:

Code: Select all

c:\pstools\psexec \\[remote machine] -u [user] -p [password] -h -w "c:\test\exe\dir" -i 1 -accepteula "c:\test\exe\dir\SmokeTest\SmokeTest\bin\Debug\SmokeTest.exe /zr /rf:c:\test\exe\dir\TestResultt\SmokeTest" 
I think the powershell script a little over-complicates things and could be a reason of your problems? I'm not very familiar with running things via psexec/powershell, but above script should work just fine?

Anyway, I would suggest to implement a full featured continuous integration tool (like Jenkins) instead of messing with psexec. It would open you a whole new world of possibilities for remote execution and management for your tests. And while the initial configuration is not always a smooth process, it's definitely worth the problems in a long run ;)