Runas in another Windows terminal session

前端 未结 5 800
忘了有多久
忘了有多久 2020-12-16 03:15

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

5条回答
  •  暖寄归人
    2020-12-16 03:48

    There is a commandline tool and it’s called RunInSession. You need to specify at least the SessionId in which you want to launch the process and which process you want to launch. Optional is servername if you want to launch on a remote server. If you run it without parameters a dialog with possible parameters is shown:

    RunInSession

    Currently supported OS versions are Windows XP, 2003, Vista and 2008.

    The program needs to run in the context of the Localsystem user, therefore it temporarily installs itself as service and start itself. With the WTSQueryUserToken it obtains the Primary User token of the requested Terminal Session. Finally the process is launched with CreateProcessAsUser and the service deletes itself.

    More details:

    • How to launch a process in a Terminal Session
    • Launching an interactive process from Windows Service in Windows Vista and later

提交回复
热议问题