利用qwinsta和rwinsta察看连接到一个机器的连接数

来源:互联网 发布:网络机顶盒插上u盘 编辑:程序博客网 时间:2024/06/15 04:50

转载地址:http://blog.itpub.net/12482/viewspace-992939/


平时我们可能会遇到这样的一种情况:需要对某台机器进行远程桌面连接,而验证完用户名和密码后提示这台机器的连接数已经达到最大值。这个时候就可以利用qwinsta和rwinsta察看连接到这个机器的连接以及断开某个连接。

察看连接: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.

用法示例:qwinsta /server:test-machine
显示结果
SESSIONNAME USERNAME ID STATE TYPE DEVICE
console 0 Conn wdcon
rdp-tcp 65536 Listen rdpwd
Gogboy 1 Disc rdpwd
Sunny 2 Disc rdpwd
这个结果显示有两个普通用户(Gogboy, Sunny)保留着对该机器(test-machine)的会话。可以通过下面的rwinsta段开

断开连接:rwinsta
用法:
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.

用法示例:rwinsta 2 /server:test-machine
这样就把上面用户Sunny的会话从该机器断开了。


0 0