Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to use PSExec to kick off a console application on a remote computer in an interactive state. When I run something like this:

PsExec.exe -s -d -i 1 \\MyServer notepad.exe

It launches Notepad just fine. If I then run this:

PsExec.exe -s -d -i 1 \\MyServer C:\Temp\MyConsoleApp.exe

It launches the command windows but doesn't do anything as far as I can tell. As in, when I run my console application locally, it displays a "heartbeat" every 5 seconds, but when I run it remotely, nothing is displayed in the command window. The .exe does show up as a process in Task Manager. Any ideas?

share|improve this question
up vote 2 down vote accepted

i think you have to set the working directory with -w :

PsExec.exe -s -d -i 1 -w c:\temp \\MyServer MyConsoleApp.exe

http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx

share|improve this answer
    
That did the trick. Thanks! – Focker Nov 30 '12 at 12:56

I think you can look at the session Id for your current user and pass it as parameter with -i For example :

PsExec.exe -s -d **-i 2** -w c:\temp \\MyServer MyConsoleApp.exe

To look at the correct session Id you can open cmd and run command : query session Sometimes the session Id is 2 for the active user you want to start process for, so try looking for your correct session Id and use it with -i patameter. It should work. It worked for me.

share|improve this answer
    
How do I look for a session ID? – Thomas Sep 4 '15 at 9:02

To look for a session ID of a User, open Task manager on that particular computer and look for your logged in username on Users Tab.

share|improve this answer
    
This doesn't appear to address the question. – EightBitTony Jan 5 at 14:12

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.