获取断开连接的用户并注销他们 [英] Get disconnected users and logOff them

查看:172
本文介绍了获取断开连接的用户并注销他们的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用命令行中的凭据登录到远程服务器,并检查断开连接的用户,然后将其设置为 logOff



这是我到目前为止一直在尝试并能正常工作的方式。但是我得到了所有我不想要的用户列表。



到目前为止,这是我的代码,用于查找连接到远程桌面的用户。



quser / server:myservername



对于单独注销,我正在使用: / p>

注销/ server:myservername 1 / v



现在我的问题是,如果 个用户超过 1 ,我该如何查找谁是谁的列表断开连接并使其注销。

解决方案

根据我在Google搜索中看到的信息,quser返回了已连接用户列表,以及会话ID colu mn。只需将注销/ server:myservername 1 / v命令中的 1替换为您要注销的会话,它应该注销该会话。



另一个选项是设置组策略计时器,该计时器将在设置的超时时间后注销断开连接的用户。这是一个示例的链接: http ://talkingtechnical.blogspot.com/2009/05/creating-group-policy-to-log-off-remote.html



将其设置为此级别意味着服务器将管理连接,而不是依靠程序来运行和执行连接。


I am trying to loging into remote server using credentials from command line and checking for the users who got disconnected and I would make them logOff programatically.

This is the way I'm trying to do as of now and bit working.But I'm getting all the users list which I don't want.

So far this is my code for finding out the users on remote desktop who got connected to it.

quser /server:myservername

For Logging Off individually I am using this:

logoff /server:myservername 1 /v

Now my question is If there are more than "1" user how do I find the list of who all are got disconnected and make them LogOff.

解决方案

From what I can see on my Google searches, quser returns the list of users connected, as well as a session ID column. Simply replace the "1" in your "logoff /server:myservername 1 /v" command with the session you want to log off and it should log that session off instead.

Another option is to set a group policy timer which will logout disconnected users after the timeout period set. Here is a link to an example: http://talkingtechnical.blogspot.com/2009/05/creating-group-policy-to-log-off-remote.html

Setting it at this level means the server will manage the connections rather than rely on a program to run and do so.

这篇关于获取断开连接的用户并注销他们的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆