当前位置: 移动技术网 > IT编程>数据库>MSSQL > 使用xp_cmdshell注销Windows登录用户(终端服务器超出最大连接数)

使用xp_cmdshell注销Windows登录用户(终端服务器超出最大连接数)

2017年12月12日  | 移动技术网IT编程  | 我要评论

葡京赌场 ag001,德国19号,案例

公司日常项目更新使用tfp,服务器一般维护用远程桌面管理,所以经常登录到服务器, 但有时由于某种原因,登录到服务器后,帐号没有及时注销,致使后面无法登录到服务器,

显示错误如

出现这样的问题还真麻烦,跑机房光手续都要两三天才能搞好.还好公司一直保留有sa帐号,

这就好办了,用sql注销一个windows登录用户即可.

首先打开xp_cmdshell
--执行xp_cmdshell要开启xp_cmdshell
exec sp_configure 'show advanced options', 1
reconfigure with override
reconfigure
exec sp_configure 'xp_cmdshell', 1
reconfigure with override
reconfigure

查看当前windows已登录用户

exec xp_cmdshell 'query user'

注销id为2的administrator用户
exec xp_cmdshell 'logoff 2'

--关闭xp_cmdshell
exec sp_configure 'xp_cmdshell', 0
reconfigure with override  
reconfigure
exec sp_configure 'show advanced options', 0
reconfigure with override
reconfigure

ok,搞定,又可以远程桌面了.

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网