tsdiscon

Applies to: Windows Server 2022, Windows Server 2019, Windows Server 2016, Windows Server 2012 R2, Windows Server 2012

Disconnects a session from a Remote Desktop Session Host server. If you don't specify a session ID or session name, this command disconnects the current session.

Important

You must have Full Control access permission or Disconnect special access permission to disconnect another user from a session.

Note

To find out what's new in the latest version, see What's New in Remote Desktop Services in Windows Server.

Syntax

tsdiscon [<sessionID> | <sessionname>] [/server:<servername>] [/v]

Parameters

Parameter Description
<sessionID> Specifies the ID of the session to disconnect.
<sessionname> Specifies the name of the session to disconnect.
/server:<servername> Specifies the terminal server that contains the session that you want to disconnect. Otherwise, the current Remote Desktop Session Host server is used. This parameter is required only if you run the tsdiscon command from a remote server.
/v Displays information about the actions being performed.
/? Displays help at the command prompt.

Remarks

  • Any applications running when you disconnected the session are automatically running when you reconnect to that session with no loss of data. You can use the reset session command to end the running applications of the disconnected session, but this may result in loss of data at the session.

  • The console session can't be disconnected.

Examples

To disconnect the current session, type:

tsdiscon

To disconnect Session 10, type:

tsdiscon 10

To disconnect the session named TERM04, type:

tsdiscon TERM04