The following page is a list of several commands available on Terminal Server workstations and servers.
These commands can be used in batch files or other scripting languages.
The syntaxes listed are for Windows 2000 Advanced Server (SP3).
From a reliable source I know they are identical in NT 4, XP and 2003.
In the current version of Longhorn, though, CHGLOGON /QUERY currently directs its output to standard error instead of standard output. This may still change in a following version.

 

  • ACINIUPD
    Application Compatibility INI Update (see notes on ACINIUPD by Christoph Geiser)
  • CHANGE
    • CHGLOGON or CHANGE LOGON
      Enable or disable session logins
    • CHGPORT or CHANGE PORT
      List or change COM port mappings for DOS application compatibility
    • CHGUSR or CHANGE USER
      Change Install Mode
  • LOGOFF
    Terminates a session
  • MSG
    Sends a message to the specified user(s)
  • QUERY
    • QAPPSRV or QUERY TERMSERVER
      Displays the available application terminal servers on the network
    • QFARM or QUERY FARM
      Display information about servers on the local farm
    • QPROCESS or QUERY PROCESS
      Displays information about processes
    • QSERVER or QUERY SERVER
      Display information about available ICA-enabled servers on the network
    • QUSER or QUERY USER
      Display information about users logged on to the system
    • QWINSTA or QUERY SESSION
      Display information about Terminal Sessions
  • RESET SESSION
    Reset the session subsytem hardware and software to known initial values
  • SHADOW
    Monitor another Terminal Services session
  • TSCON
    Attaches a user session to a terminal session
  • TSDISCON
    Disconnects a terminal session
  • TSKILL
    Ends a process
  • TSPROF
    Copies or updates the terminal server user configuration information
  • TSSHUTDN
    Shut down a server in a controlled manner
     
     
  • TSCMD
    Read or set several Terminal Server related user properties.
    A very useful free third party command line tool by SystemTools Software Inc.
    Download it here.

 

ACINIUPD

ACINIUPD: utility to update the INI file (Application Compatibility INI Update).

ACINIUPD        [ /e ¦ /k ]  [ /u ] [ /v ]  ini_file  section  key  new_value
 
   ini_file    The INI file to be updated
   section    Specified the [section] within the INI file
   key    Specifies the key to be added or updated
   new_value    Specifies the new value to be assigned to key
   /e    Update the value for the key in the section specified
   /k    Update the key name with the new key name in the section specified
   /u    Update INI file in user's windows directory (or any other directory) instead of system directory
   /v    Verbose mode

 

CHANGE

CHANGE        { LOGON ¦ PORT ¦ USER }
 
CHANGE LOGON    Starts CHGLOGON
CHANGE LOGON    Starts CHGPORT
CHANGE LOGON    Starts CHGUSR

 

CHGLOGON

Enable or disable session logins

CHANGE LOGON        { /QUERY ¦ /ENABLE ¦ /DISABLE }
 
   /QUERY    Query current session login mode
   /ENABLE    Enable user login from sessions
   /DISABLE    Disable user login from sessions

 

CHGPORT

List or change COM port mappings for DOS application compatibility

CHANGE PORT        portx=porty ¦ /D portx ¦ /QUERY ]
 
   portx=porty    Map port x to port y
   /D portx    Delete mapping for port x
   /QUERY    Display current mapping ports

 

CHGUSR

Change Install Mode

CHANGE USER        { /EXECUTE ¦ /INSTALL ¦ /QUERY }
 
   /EXECUTE    Enable execute mode (default)
   /INSTALL    Enable install mode
   /QUERY    Display current settings

 

LOGOFF

Terminates a session

LOGOFF        sessionname ¦ sessionid ]  [ /SERVER:servername ]  [ /V ]
 
   sessionname    The name of the session
   sessionid    The ID of the session
   /SERVER:servername    Specifies the Terminal server containing the user session to log off (default is current)
   /V    Displays information about the actions performed

 

MSG

Sends a message to the specified user(s)

MSG        username ¦ sessionname ¦ sessionid ¦ @filename ¦ * }  [ /SERVER:servername ]  [ /TIME:seconds ]  [ /V ]  [ /W ]  message
 
   username    The user to receive the message
   sessionname    The name of the session
   sessionid    The ID of the session
   @filename    A file with users, session names and session IDs to receive the message
   *    Sends the message to all users on the system
   /SERVER:servername    Specifies the Terminal server containing the user session to log off (default is current)
   /TIME:seconds    Specifies time to wait for a confirmation for the user who received the message
   /V    Displays information about the actions performed
   /W    Wait for response from users
   message    Specifies the text to send.
If no message is entered it will send STDIN.
To send a text within a file, type "<" and then the file name.

 

QUERY

QUERY        { FARM ¦ PROCESS ¦ SERVER ¦ SESSION ¦ TERMSERVER ¦ USER }
 
QUERY FARM    Starts QFARM
QUERY PROCESS    Starts QPROCESS
QUERY SERVER    Starts QSERVER
QUERY SESSION    Starts QWINSTA
QUERY TERMSERVER    Starts QAPPSRV
QUERY USER    Starts QUSER

 

QAPPSRV

Displays the available application terminal servers on the network

QUERY TERMSERVER        servername ]  [ /DOMAIN:domain ]  [ /ADDRESS ]  [ /CONTINUE ]
 
   servername    Identifies a Terminal server
   /DOMAIN:domain    Displays information for the specified domain (defaults to the current domain)
   /ADDRESS    Displays network and node addresses
   /CONTINUE    Does not pause after each screen of information

 

QFARM

Display information about servers on the local farm

QUERY FARM        servername [ /ADDR ¦ /APP ¦ /APP appname ] ]  [ /TCP ]  [ /IPX ]  [ /NETBIOS ]  [ /CONTINUE ] [ /APP ¦ /APP appname ¦ /DISC ¦ /LOAD ¦ /OFFLINE ¦ /OFFLINE zonename ¦ /ONLINE ¦ /ONLINE zonename ¦ /PROCESS ¦ /ZONE ¦ /ZONE zonename ] 
 
   servername    Identifies a Terminal server
   /TCP    Display TCP/IP data
   /IPX    Display IPX data
   /NETBIOS    Display NETBIOS data
   /ADDR    Display address data on selected server
   /APP    Display application names and server load
   /DISC    Display disconnected session data
   /LOAD    Display server load
   /OFFLINE    Display offline servers
   /ONLINE    Display online servers
   /PROCESS    Display active processes
   /ZONE    Display zones and data collectors
   /CONTINUE    Does not pause after each screen of information

 

QPROCESS

Displays information about processes

QUERY PROCESS        [ * ¦ processid ¦ username ¦ sessionname ¦ /ID:nn ¦ programname ]  [ /SERVER:servername ]  [ /SYSTEM ]
 
   *    Display all visible processes
   processid    Display process specified by processid
   username    Display all processes belonging to username
   sessionname    Display all processes running at sessionname
   /ID:nn    Display all processes running at session nn
   programname    Display all processes associated with programname
   /SERVER:servername    The Terminal server to be queried
   /SYSTEM    Displays process information for system processes

 

QSERVER

Display information about available ICA-enabled servers on the network

QUERY SERVER        server [ /PING [ /COUNT:n ]  [ /SIZE:n ] ¦ /STATS ¦ /RESET ¦ /LOAD ¦ /ADDR ] ]  [ /TCP ]  [ /IPX ]  [ /NETBIOS ]  [ /TCPSERVER:x ]  [ /IPXSERVER:x ]  [ /NETBIOSSERVER:x ]  [ /LICENSE ¦ /APP ¦ /GATEWAY ¦ /SERIAL ¦ /DISC ¦ /SERVERFARM ¦ /VIDEO ]  [ /CONTINUE ] 
 
   server    Identifies a Terminal server
   /TCP    Display TCP/IP data
   /IPX    Display IPX data
   /NETBIOS    Display NETBIOS data
   /TCPSERVER:x    TCP/IP default server address
   /IPXSERVER:x    IPX default server address
   /NETBIOSSERVER:x    NetBIOS default server address
   /LICENSE    Display user licenses
   /APP    Display application names and server load
   /DISC    Display disconnected session data
   /LOAD    Display load data on selected server
   /GATEWAY    Display configured gateway addresses
   /SERIAL    Display license serial numbers
   /SERVERFARM    Display server farm names and server load
   /PING    Ping selected server
   /COUNT:n    Number of times to ping (default 5)
   /SIZE:n    Size of ping buffers (default 256 bytes)
   /STATS    Display browser statistics on selected server
   /RESET    Reset browser statistics on selected server
   /ADDR    Display address data on selected server
   /VIDEO    Display VideoFrame data
   /IGNORE    Ignore warning message about interoperability mode
   /CONTINUE    Does not pause after each screen of information

 

QUSER

Display information about users logged on to the system

QUERY USER        username ¦ sessionname ¦ sessionid ]  [ /SERVER:servername ]
 
   username    Identifies the username
   sessionname    Identifies the session named sessionname
   sessionid    Identifies the session with ID sessionid
   /SERVER:servername    The server to be queried (default is current)

 

QWINSTA

Display information about Terminal Sessions

QUERY SESSION        sessionname ¦ username ¦ sessionid ]  [ /SERVER:servername ]  [ /MODE ]  [ /FLOW ]  [ /CONNECT ]  [ /COUNTER ]
 
   sessionname    Identifies the session named sessionname
   username    Identifies the session with user username
   sessionid    Identifies the session with ID sessionid
   /SERVER:servername    The server to be queried (default is current)
   /MODE    Display current line settings
   /FLOW    Display current flow control settings
   /CONNECT    Display current connect settings
   /COUNTER    Display current Terminal Services counters information

 

RESET SESSION

Reset the session subsytem hardware and software to known initial values

RESET SESSION        sessionname ¦ sessionid }  [ /SERVER:servername ]  [ /V ]
 
   sessionid    The ID of the session
   sessionname    The name of the session
   /SERVER:servername    The server containing the session (default is current)
   /V    Display additional information

 

SHADOW

Monitor another Terminal Services session

SHADOW        sessionname ¦ sessionid }  [ /SERVER:servername ]  [ /V ]
 
   sessionid    The ID of the session
   sessionname    The name of the session
   /SERVER:servername    The server containing the session (default is current)
   /V    Display additional information

 

TSCON

Attaches a user session to a terminal session

TSCON        sessionid ¦ sessionname ]  [ /SERVER:servername ]  [ /DEST:sessionname ]  [ /PASSWORD:pw ]  [ /V ]
 
   sessionid    The ID of the session
   sessionname    The name of the session
   /SERVER:servername    The name of the Terminal server to connect to (default is current)
   /DEST:sessionname    Connect the session to destination sessionname
   /PASSWORD:pw    Password of user owning identified session
   /V    Displays information about the actions performed

 

TSDISCON

Disconnects a terminal session

TSDISCON        sessionid ¦ sessionname ]  [ /SERVER:servername ]  [ /V ]
 
   sessionid    The ID of the session
   sessionname    The name of the session
   /SERVER:servername    Specifies the Terminal server (default is current)
   /V    Displays information about the actions performed

 

TSKILL

Ends a process

TSKILL        processid ¦ processname  [ /SERVER:servername ]  [ /ID:sessionid ¦ /A ]  [ /V ]
 
   processid    Process ID for the process to be terminated
   processname    Process name to be terminated
   /SERVER:servername    Server containing processID (default is current)
/ID or /A must be specified when using processname and /SERVER
   /ID:sessionid    End process running under the specified session
   /A    End process running under ALL sessions
   /V    Display information about actions being performed

 

TSPROF

Copies or updates the terminal server user configuration information

TSPROF /UPDATE        [ /DOMAIN:domainname ¦ /LOCAL ]  /PROFILE:<pathusername
TSPROF /COPY        [ /DOMAIN:domainname ¦ /LOCAL ]  [ /PROFILE:<path> ]  src_usr  dest_usr
TSPROF /Q        [ /DOMAIN:domainname ¦ /LOCAL ]  username 
 
   /UPDATE    Updates the profile path information for username
   /COPY    Copies the user configuration information from src_usr to dest_usr
   /Q    Shows the current profile path for username
 
   /DOMAIN:domainname    Specifies the domain to work in
   /LOCAL    Works on the local computer
 
   /PROFILE:<path>    Specifies the profile path to use
   username    Specifies the user to work on
   src_usr    Specifies the user to copy the configuration information from
   dest_usr    Specifies the user to copy the configuration information to

 

TSSHUTDN

Shut down a server in a controlled manner

TSSHUTDN.EXE        wait_time ]  [ /SERVER:servername ]  [ /REBOOT ¦ /POWERDOWN ]  [ /DELAY:logoffdelay ]  [ /V ]
 
   wait_time    Seconds to wait after user notification before terminating all user sessions (default is 60)
   /SERVER:servername    The server to shut down (default is current)
   /REBOOT    Reboot the server after user sessions are terminated
   /POWERDOWN    The server will prepare for powering off
   /DELAY:logoffdelay    Seconds to wait after logging off all connected sessions (default is 30)
   /V    Display information about actions being performed

 

TSCMD

A free "third party" command-line utility by SystemTools.com to set terminal server user settings.
All eighteen (18) terminal server settings can be set.

TSCMD        server  user  setting new_value ] 
 
   server    Domain controller of the Terminal Servers' domain
   user    The user account to be queried or modified
   setting    One of the following properties:
      InitialProgram
      WorkingDirectory
      InheritInitialProgram
      AllowLogonTerminalServer
      TimeoutConnection
      TimeoutDisconnect
      TimeoutIdle
      DeviceClientDrives
      DeviceClientPrinters
      DeviceClientDefaultPrinter
      BrokenTimeoutSettings
      ReconnectSettings
      ModemCallbackSettings
      ModemCallbackPhoneNumber
      ShadowingSettings
      TerminalServerProfilePath
      TerminalServerHomeDir
      TerminalServerHomeDirDrive
   new_value    Optional new value for the specified setting (property).
If left out the current value of setting will be displayed.
Check TSCMD's readme for details on valid new values.
 
Copyright 2000, SystemTools.com http://www.systemtools.com

 


Zurück