Several neat utilities that are sprinkled throughout this chapter, and some that I didn't cover in detail, enable you to perform much of the functionality you find in the graphical management interfaces for Terminal Services from the command line. I've collected them all in this final section of the chapter as a quick reference of sorts:
Change logon
Enables logons (using the /enable switch) or disables logons (using the /disable switch) to a specific server. Use /query to find out what mode a machine is currently in.
Change port
Modifies serial port mappings for programs that operate in DOS compatibility mode. Use /query to find out the current mappings.
Change user
Changes the mode in which a Terminal Services machine operates. Using /install switches the machine into install mode to add applications of multi-session use, and using /execute disables the install mode for normal functionality. Use /query to determine the current mode. See earlier in this chapter for detailed information on this command.
Cprofile
Cleans profiles for inefficient use of space, and removes from the Registry any file associations the user has configured. Profiles must not be in use to run this tool. Use /L to clean every local profile, /I to prompt you before cleaning each profile, and /V to display each action the program has taken.
Flattemp
Enables flat temporary directoriesthat is, enables the redirection of temporary directories to a location other than the default. /enable enables these directories obviously, /disable does the opposite, and /query displays the feature's current status.
Logoff
Logs off a session. Use logoff sessionname or logoff sessionid to identify the session to end, and specify a particular server using the /V switch if necessary. See earlier in this chapter for detailed information on this command.
Msg
Sends a message. See earlier in this chapter for detailed information on this command.
Query process
Displays a table listing processes by session. See earlier in this chapter for sample output of this command.
Query session
Displays a table listing sessions on a specific server. See earlier in this chapter for sample output of this command.
Query termserver
Displays a list of known terminal servers in a domain. See earlier in this chapter for sample output of this command.
Query user
Displays a list of users currently logged on to terminal services sessions. See earlier in this chapter for sample output of this command.
Register
Sets an application to operate as either a system global resource, with the /system switch, or a user global resource, with the /user switch. Include the executable file's name as an argument.
Reset session
Resets a session. Use reset sessionname or reset sessionid to identify the session to end, and specify a particular server using the /V switch if necessary. See earlier in this chapter for detailed information on this command.
Shadow
Views the display for another user's session. You must run this over a Terminal Services connection to the host machine. See earlier in this chapter for detailed information on this command.
Tscon
Connects to another session running on a server. See earlier in this chapter for detailed information on this command.
Tsdiscon
Disconnects from another session running on a server. See earlier in this chapter for detailed information on this command.
Tskill
Kills a certain process. Use tskill processid or tskill processname. To specify a server, use the /server switch, and to specify a certain session under which a process is running, use /ID:sessionid. To end a process running under all sessions, issue the /a switch.
Tsprof
Configures profiles for users connecting to a terminal server. See earlier in this chapter for detailed information on this command.
Tsshutdn
Shuts down a terminal server. You can specify an amount of time to wait before shutting down the machine by adding the number as an argument after the command name (i.e., tsshutdn 120 to wait two minutes). You also can specify whether to simply restart the machine by using the /reboot switch, or to power it down completely with the /powerdown switch.