Company daily project update using TFP, server general maintenance with Remote Desktop management, so often log on to the server, but sometimes for some reason, login to the server, the account did not log off in time, resulting in the following can not log on to the server,
Display errors such as
This problem is really troublesome, run the machine room light formalities must be two or three days to do well. Fortunately, the company has been keeping the SA account,
This is easy to do, log off a Windows logged-on user with SQL.
First Open xp_cmdshell
--Execute xp_cmdshell to open xp_cmdshell
EXEC sp_configure ' show advanced options ', 1
Reconfigure with OVERRIDE
Reconfigure
EXEC sp_configure ' xp_cmdshell ', 1
Reconfigure with OVERRIDE
Reconfigure
View current Windows Logged-in users
EXEC xp_cmdshell ' query user '
Logoff administrator user with ID 2
EXEC xp_cmdshell ' Logoff 2 '
--Close xp_cmdshell
EXEC sp_configure ' xp_cmdshell ', 0
Reconfigure with OVERRIDE
Reconfigure
EXEC sp_configure ' show advanced options ', 0
Reconfigure with OVERRIDE
Reconfigure
Ok, done, and can be Remote Desktop.