JAEN

Windows

tscon / tsdiscon

CautionManage RDP sessions

tscon <sessionID>

Switches/disconnects sessions; the famous trick pulls an RDP session back to the console.

Examples

  • query session && tscon 2 /dest:consoleMove session 2 to console
  • query sessionList session IDs and states (same as qwinsta)
  • tsdiscon 2Disconnect session 2 (apps keep running)
  • logoff 3Log off session 3
  • query user /server:srv01Users logged on to a remote server

Syntax

tscon <id|name> [/dest:console] / tsdiscon <id>

Key points

  • Disconnecting leaves apps running; logging off ends them.
  • Running tscon <id> /dest:console from inside RDP drops the RDP connection and moves the session to the console unlocked, which keeps GUI apps running.
  • Run it from an elevated command prompt.

When it does not work

  • Connecting to another user's session needs that user's password (/password).
  • A wrong ID disconnects someone else. Always check with query session first.

Before you run it

Affects the user's live session.

Related commands

The same reference, with no signal at all

Every command on this site, held on your device. The app adds 632 more: 1,510 commands and 120 fix flows, searchable with no connection. Free to install, no ads (some content is a one-time purchase).

Get it free on the App Store