Search code examples
windowsterminal-servicesrunas

Runas in another Windows terminal session


For simplicity, let's say the user Administrator is logged in in terminal session 2. Another user Boda is logged in terminal session 3.

Is it possible to runas a program in session 3 from session 2?

For simplicity, let's say I want to start calc.exe in session 3 (in Boda's session). How do I do that? Can it be done with runas?


Solution

  • Like Harry Johnston suggested in a comment you can do this using the psexec tool available on TechNet. I've tried it using a Windows 2008 Server running Terminal Services and managed to start various applications in another users session (although not calc.exe - it started but minimized and the window refused to restore), among them cmd.exe.

    The command I used was psexec.exe -i 3 cmd.exe where 3 is the session number (that you can get from qwinsta.exe).

    Example: Remote session, logged on as Administrator; using qwinsta to enumerate sessions and psexec to start cmd.exe on another session. enter image description here

    Another session: logged on as Patrick, with the cmd.exe window on the desktop opened by Administrator (which the window title reveals too). enter image description here