windows远程桌面断开连接后不锁定被控主机

发布时间 2023-10-31 22:11:36作者: memo2586

通过让此账号本地登录来断开远程连接,以实现不锁定的效果。

在被控主机以管理员身份运行以下bat脚本来断开连接

for /f "skip=1 tokens=3" %%s in ('query user %USERNAME%') do (%windir%\System32\tscon.exe %%s /dest:console)

微软社区官方提供的解决思路:https://answers.microsoft.com/zh-hans/windows/forum/all/%E6%88%91%E5%B8%8C%E6%9C%9B%E6%96%AD%E5%BC%80/3895c98f-f6d3-4c7b-abe0-56ac8274bbcf?tab=AllReplies#tabs