# Start .exe process from remote computer



## skhalaman (Jun 22, 2011)

Hello, nice to meet you all,

I have a server that has a .exe process that need to be up and running all the time. once this process hangs, we ususally access the server remotly (mstsc) and start the process again. I'm looking to create a batch file to start this process from my pc and I have managed to do so by using telenet and I also have use a tool called psexec. the thing is that, the process start in task manager but it doesnt show on GUI on desktop like it does when I double click on it manually. any advice/help is appreciated.

I thank you in advance


----------



## Squashman (Apr 4, 2003)

And you used the -I switch?


----------



## skhalaman (Jun 22, 2011)

no but I tried it now and I added -I to the code and still it didnt work. When I start the process (.exe file) manually from the server by double clicking, it start in task manager and on the server desktop showing the status of the program (i.e idle). but when I use cmd remotly to start the process, it does start but only in task manager. how can i make it start remotly excatly as it starts manaully?

thanks


----------



## Squashman (Apr 4, 2003)

You need to use psexec to start the process remotely with the -I switch and the username you are using with PSEXEC would have to be the same username that is logged into the desktop. I know this works because I have done it before. I used to play jokes on my wife by making a sheep bounce across her desktop.

psexec \\computername *-u* username_of_remote_user *-p* password *-i* "c:\program files\my app\foo.exe"


----------



## scrfix (May 3, 2009)

Squashman, now that's funny.. Sheep bouncing across the desktop. LOL.

From what I read, he stated he is on the users computer remoted in. Can he utilize this since he is remoted in to the computer and more than likely in a batch file or command line.

psexec \\%computername% -u %username% -p <Needs Password> -i "c:\program files\my app\foo.exe"

This way, he only needs to know the password. If this is a common password then you could even set it as:
set _password=<password here> and then utilize %_password% in the password spot.

*Update*
Let's say that you have multiple computers on the network but only know the IP addresses for them. You can utilize a FOR statement in BATCH with the NSLOOKUP <ip address> command.

This will return something like this:
Server: UnKnown
Address: 192.168.1.2
Name: test-pc.mydomain.local
Address: 192.168.1.101

You can grab the computer name and then set a variable to that computer name:
So now you have the computer name without knowing what it is ahead of time.

Now for the currently logged on username you should be able to use PsLoggedOn:
http://technet.microsoft.com/en-us/sysinternals/bb897545.aspx

This should get you everything that you need to be able to set this up automatically if you are not already logged in to the computer itself. The only thing that you will need is the password.


----------

