Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I would like to start an application remotely. I am using the following PsExec command:

PsExec \\computerOne -u Domain\User1 -p 123456 -x "C:\Windows\System32\calc.exe"

I tried to use -i so that the program interacts with the desktop:

PsExec \\computerOne -u Domain\User1 -i 123456 -x "C:\Windows\System32\calc.exe"

but that does not work. The error from the second example is:

calc.exe exited on computerOne with error code -1073741502"

If I omit the specification and just write the path of the exe, the process is listed in the taskmanager but I can not see any UI. Do I have to change any settings on my Desktop on which I want to start the program?

share|improve this question

3 Answers 3

up vote 4 down vote accepted

What you are seeing is likely to be an effect of Session 0 isolation - psexec installs and starts a new service on the remote machine, but the default session it is starting your process in is 0, and thus unavailable to the currently logged on user (at least on from Windows Vista / Server 2008). You need to specify the session number after the -i parameter. You can query the currently logged on users (and their session numbers) using the quser /SERVER:computerOne command beforehand.

For quick&dirty testing you can assume that the session ID of the first interactively logged-on user is "1".

share|improve this answer
    
Thank you. It works fine. –  seven-ply Feb 7 '12 at 12:33

You can also just take out the -x and replace with -I, it should open up PsExec \computerOne -u Domain\User1 -p 123456 -i "C:\Windows\System32\calc.exe"

share|improve this answer

The root-cause appears to be leaky handles made by the Console.Write method in Microsoft.powershell.consolehost.dll. The -1073741502 exit code in hex is 0xC0000142 (status_dll_init_failed).

This appears to be isolated to Windows 7 & 2008 (as per Microsoft's KB2701373).

Side-Note: Several "Fixes" elsewhere on the Internet are attributed to doing some sort of magical incantation, then closing PowerShell & opening a new instance. However, 'restarting' PowerShell is what actually temporarily solves the problem.

share|improve this answer

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.