是否有可能使用.bat文件禁用Windows XP SP2远程桌面function? 我已经试图find一个服务,只是停下来开始,但我没有运气。
背景是我必须在远程PC上运行时间关键testing,并且我必须确保在testing运行时没有人login。 个人电脑需要networking连接,所以我需要一些特定的远程桌面。
禁用远程桌面:
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server" /v "fDenyTSConnections" /t REG_DWORD /d "1" /f
启用远程桌面:
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server" /v "fDenyTSConnections" /t REG_DWORD /d "0" /f
值得注意的是,如果您使用组策略来启用远程桌面,则应该使用组策略来禁用它。 否则,您将需要痒痒的这个键/值,而不是:
HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services\fDenyTSConnections
看来下面的脚本正是你所需要的。
REM ** Disable new logons change logon /disable REM ** Throw out all existing sessions by resetting the listener session for /f "tokens=2" %%i in ('qwinsta ^| find /i "listen"') do echo y | rwinsta %%i REM ** Maintenance jobs like backup comes here REM ** start /wait ensures that this job waits until the command REM ** is executed completely before going on to the next command start /wait <your maintenance command comes here> REM ** Maintenance is finished. Let users in again change logon /enable
http://ts.veranoest.net/ts_faq_administration.htm#reset_sessions
好的,在这一点上我错了:
你不能,AFAIK。 这没有服务。
但是这个依然如此。
您可以阻止RDP侦听端口,默认值为3389。