GGGGGGGGGGGGG

导航

Terminal Service基本脚本

  • Writing Terminal Service Based Scripts (Part 1)
      Change Logon \ Change Port \ Query Session
  • Writing Terminal Service Based Scripts (Part 2)
      Query termserver \ Query Process
  • Writing Terminal Service Based Scripts (Part 3)
      Query user \ Reset Session \ LOGOFF \ TSDISCON \ TSSHUTDN
  • Writing Terminal Service Based Scripts (Part 4)
      MSG
  • Writing Terminal Service Based Scripts (Part 5)
      Change User \ TSCON
  • Writing Terminal Service Based Scripts (Part 6)
      Create a report
  • Writing Terminal Service Based Scripts (Part 7)
      Write Script ..
  • Writing Terminal Service Based Scripts (Part 8)
  • Writing Terminal Service Based Scripts (Part 9)
  • Writing Terminal Service Based Scripts (Part 10)
  •  

    Standard Terminal Server Commands

    A summary of the bulti-in Terminal Services commands, drawn from a Windows 2000 Service Pack 3 Terminal Server in Application Mode.

    http://dev.remotenetworktechnology.com/cmd/tscmd.htm

    chglogon, change logon

    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.

    Unlike the other change commands, when the /QUERY switch is used chglogon returns output on standard error.  If capturing output in a batch file, make sure you capture stderr or simply run it with 2>CON appended to redirect error to stdout.

    chgport, change port

    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 user

    Change Install Mode.

    CHANGE USER {/EXECUTE | /INSTALL | /QUERY}

    /EXECUTE Enable execute mode (default).
    /INSTALL Enable install mode.
    /QUERY Display current settings.

    flattemp

    Enable or disable flat temporary directories.

    FLATTEMP [/QUERY | /ENABLE | /DISABLE]

    /QUERY Query current setting.
    /ENABLE Enable flat temporary directories.
    /DISABLE Disable flat temporary directories.

    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.

    qappsrv, query termserver

    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.

    qprocess, query process

    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

    quser, query user

    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, query session

    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.

    rwinsta, reset session

    RESET { SESSION }
    Reset the session subsytem hardware and software to known initial values.

    RESET SESSION {sessionname | sessionid} [/SERVER:servername] [/V]

    sessionname Identifies the session with name sessionname.
    sessionid Identifies the session with ID sessionid.
    /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]

    sessionname Identifies the session with name sessionname.
    sessionid Identifies the session with ID sessionid.
    /SERVER:servername The server containing the session (default is current).
    /V Display information about actions being performed.

    Attaches a user session to a terminal session.

    tscon

    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.

    Disconnects a terminal session.

    tsdiscon

    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

    TSPROF /UPDATE [/DOMAIN:domainname|/LOCAL] /PROFILE:<path> username
    TSPROF /COPY [/DOMAIN:domainname|/LOCAL] [/PROFILE:<path>] src_usr dest_usr
    TSPROF /Q [/DOMAIN:domainname|/LOCAL] username

    tsshutdn

    Shut down a server in a controlled manner.

    TSSHUTDN [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.

    posted on 2009-01-16 12:02  G Zhao  阅读(704)  评论(0编辑  收藏  举报