Launch Notepad.exe using PsExec sysinternal tool

SanjayJ picture SanjayJ · Jun 13, 2014 · Viewed 8.1k times · Source

I am trying to launch notepad.exe on remote server A from local server B.

below is the command which works fine and I could see notepad.exe process on Task Manager however when I physically remote login to server I do not see notepad launched (GUI).

C:\Windows\System32>D:\SysInternals\psexec.exe \\serverB 
-u Domain\user1 -p passXX -i -d notepad.exe

PsExec v1.98 - Execute processes remotely
Copyright (C) 2001-2010 Mark Russinovich
Sysinternals - www.sysinternals.com

notepad.exe started on serverB with process ID 3328.

How would I see notepad GUI when logged in ?

Answer

Loïc MICHEL picture Loïc MICHEL · Jun 13, 2014

is serverB a terminal server ? if so you have to specify the user's session number, otherwise notepad will be opened in the console (session 0). you can use for example query session to get the active session on you server : query session /server:serverB user1

then pass the session number to -i parameter :

psexec \\serverB -u domain\user1 -i 2 notepad.exe 

where 2 is the session of user1