1

Id like to kill and start a program on a remote machine with psexec. I use the following batch-file (c:/users/user is psexec root)

cd c:/users/user
psexec \\computername cmd /c "taskkill /im SwyxIt!.exe /f"
psexec \\computername cmd /c "taskkill /im CLMgr.exe /f"
timeout -t 5
psexec \\computername cmd /c "start C:\Program Files (x86)\SwyxIt!\SwyxIt!.exe"

but the program doesn't start!

also if i run the start command like this psexec \\computername cmd /c "C:\Program Files (x86)\SwyxIt!\SwyxIt!.exe"

It doesn't start.

If i run the command without psexec on my own machine start "C:\Program Files (x86)\SwyxIt!\SwyxIt!.exe" it works just fine.

any suggestions? I have administrator priviliges on all remote machines.

SimonS
  • 785
  • 4
  • 14
  • 29
  • Does the program require user interaction? Have you tried it on remote machines with the -i switch? – Get-HomeByFiveOClock Oct 15 '15 at 13:34
  • thx for the hint with -i, unfortunately it doesn't work. it exits with error code 3. i read that it means "path not found" but i'm very sure the path exists on the remote machine. i tried to put the path in quotes "" but it also didn't work. – SimonS Oct 15 '15 at 13:51
  • Dollars to donuts you've got the quoting mixed up somehow - this `"start C:\Program Files (x86)\SwyxIt!\SwyxIt!.exe"` is going to try starting `c:\Program`. Note when you try it on your machine you quote the path, not including "start". Also note that the first quoted parameter to `start` is the title of the command window so I'm surprised if that works fine on your machine... – TessellatingHeckler Oct 15 '15 at 15:48
  • Aside from what @TessellatingHeckler said it would look like: psexec \\computername cmd /c "Start "C:\Program Files (x86)\SwyxIt!\SwyxIt!.exe"" (Yes you CAN use double quotes in PSexec. Other than that, are you running these commands against a 32bit machine? That would also explain why the path would not be found – Get-HomeByFiveOClock Oct 15 '15 at 16:47
  • 1
    @Get-HomeByFiveOClock from his comment - `"i tried to put the path in quotes "" but it also didn't work"`. Presumably because that command will start an empty command prompt titled "c:\program files (x86)\swyxit..." – TessellatingHeckler Oct 15 '15 at 16:54

1 Answers1

1

Ok, i got it now. I also needed to activate the -s parameter

With this command it works

psexec -s -i \\computername cmd /c "start /i "SwyxIt!" "C:\Program Files (x86)\SwyxIt!\SwyxIt!.exe""

thank you for your help

SimonS
  • 785
  • 4
  • 14
  • 29