Windows 7 / Getting Started

Command-Line Tools

In addition to the graphical tools, Windows Server 2008 R2, like previous versions of Windows Server, has command-line tools that you can use to view session information, manage a session's contents, control a user's session remotely, and so forth. These command-line tools are built on the same interfaces as the graphical tools, so any information you get from one (for example, Process ID) can be used in another.

Both Windows Server 2008 R2 and Windows 7 support the Remote Desktop Services command-line tools; these tools are part of the operating system. Table-4 lists the available command-line tools.

TABLE-4 Remote Desktop Services Command-Line Tools
Command
Description
change logon or chglogonEnable, disable, drain, or query information about logons from sessions on an RD Session Host server.
change port or chgportList or change the COM port mappings to be compatible with MS-DOS applications.
logoffLog off users and delete their session from the RD Session Host server.
msgSend a message to a user or multiple users on an RD Session Host server.
query process or qprocessDisplay information about all the processes currently running on an RD Session Host server.
query session or qwinstaDisplay information about sessions on an RD Session Host server.
query termserver or qappsrvList all the RD Session Host servers on a network.
query user or quserDisplay information about the users connected to an RD Session Host server.
reset session or rwinstaTerminate a session on an RD Session Host server.
shadowEnable an administrator to view or interact with an active session of another user remotely on an RD Session Host server. You must run this command from within an RDP session on an RD Session Host for it to work.
tsconConnect to another session on an RD Session Host server (you have to be in a remote session to connect to another remote session).
tsdisconDisconnect a session from a server.
tskillTerminate a process running on an RD Session Host server. You can identify the process by image name or Process ID.
tsprofCopies the Remote Desktop Services user profile from one user to another. This command-line tool is not available for Windows 7, and although it is available for Windows Server 2008 R2, it does not work. It was used in previous versions of Terminal Services.

The following command-line tools were removed in Windows Server 2008.

  • tsshutdn: This command was used to shut down a terminal server. Use the shutdown command instead.
  • register: This command was used to register a program.
  • cprofile: This command was used to remove wasted space in a user profile and to delete file associations from the registry that were made to certain applications.
NOTE: For those who like working in Windows PowerShell, Shay Levy, a Windows PowerShell MVP, built a Terminal Services PowerShell Module to help manage and monitor RDS sessions and processes. Download the module at http://code.msdn.microsoft.com /PSTerminalServices. The Uniform Resource Locator (URL) is located on the companion media. This tool is good for programmatically interacting with sessions or gathering information from multiple machines.
[Previous] [Contents] [Next]