April 7, 2009

How to manage Terminal Services through commend-line tools

1. Connecting to another terminal session

TSCON.exe
To use TSCON, we should provide the session id or name, destination session id, and password as parameters.

2. Disconnecting from another terminal session

TSDISCON.exe
To use TSDISCON, we should provide session id or name, and specify the terminal server name of the session we wants to disconnect from as parameters.

3. Logging off a terminal session

LOGOFF.exe
To use LOGOFF to log off a terminal session, we should provide session id or name and server name as parameters.

4. Resetting a terminal session

RESET SESSION
To use RESET SESSION, we should provide session id or name and server name as parameters.

5. Sending messages to terminal users

MSG.exe
To send a message to a user on a specific server, we use:
msg “username” /server: “servername” “message”
We can also send a message to a specific session:
msg “sessionname” “message”

6. Shutting down the terminal server

TSSHUTDN.exe
There is a wait_time parameter for TSSHUTDN.exe, which is really useful. Don’t terminate users’ session immediately. Set wait_time to 60 – 90 seconds will allow users to save their work. Default value is 60 seconds. REBOOT and POWERDOWN parameters are also very useful as REBOOT will reboot the server after shutting down, POWERDOWN will prepare the server to power off.

7. Querying terminal session information

QUERY.exe is a powerful command can be used to query process, session, terminal servers, and user.

a) query process
This option displays information of all or specific processes by session. The user can specify process id, session id or name as parameters.
b) query session
This option displays information of all sessions on a terminal server.
c) query termserver
This option displays information of terminal servers in the domain.
d) query user
This option displays information of users currently logged on to terminal sessions.

8. Killing a specific process on a terminal session

TSKILL.exe
This command kills specific process on a terminal session. For example, by entering TSKILL processid it will kill the process with the specific process id; by entering TSKILL processname it will kill the process with the specific process name. The SERVER parameter can be used to specify to kill the process on a specific server. The ID parameter can be used to specify a specific session.

No comments:

Post a Comment