1.查询终端端口
xp&2003:REG query HKLMSYSTEMCurrentControlSetControlTerminal" "ServerWinStationsRDP-Tcp /v PortNumber
通用:regedit /e tsp.reg "HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlTerminal serverWds
dpwdTds cp"
type tsp.reg
2.开启XP&2003终端服务
REG ADD HKLMSYSTEMCurrentControlSetControlTerminal" "Server /v fDenyTSConnections /t REG_DWORD /d 0 /f
REG ADD HKLMSYSTEMCurrentControlSetControlTerminal" "Server /v fDenyTSConnections /t REG_DWORD /d 00000000 /f
3.更改终端端口为20008(0x4E28)
REG ADD HKLMSYSTEMCurrentControlSetControlTerminal" "ServerWds
dpwdTds cp /v PortNumber /t REG_DWORD /d 0x4E28 /f
REG ADD HKLMSYSTEMCurrentControlSetControlTerminal" "ServerWinStationsRDP-Tcp /v PortNumber /t REG_DWORD /d 0x4E28 /f
4.取消xp&2003系统防火墙对终端服务3389端口的限制及IP连接的限制
REG ADD HKLMSYSTEMCurrentControlSetServicesSharedAccessParametersFirewallPolicyStandardProfileGloballyOpenPortsList /v 3389:TCP /t REG_SZ /d 3389:TCP:*:Enabled:@xpsp2res.dll,-22009 /f
5.开启Win2000的终端,端口为3389(需重启)
echo Windows Registry Editor Version 5.00 >2000.reg
echo. >>2000.reg
echo [HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersion
etcache] >>2000.reg
echo "Enabled"="0" >>2000.reg
echo [HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindows NTCurrentVersionWinlogon] >>2000.reg
echo "ShutdownWithoutLogon"="0" >>2000.reg
echo [HKEY_LOCAL_MACHINESOFTWAREPoliciesMicrosoftWindowsInstaller] >>2000.reg
echo "EnableAdminTSRemote"=dword:00000001 >>2000.reg
echo [HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlTerminal Server] >>2000.reg
echo "TSEnabled"=dword:00000001 >>2000.reg
echo [HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesTermDD] >>2000.reg
echo "Start"=dword:00000002 >>2000.reg
echo [HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesTermService] >>2000.reg
echo "Start"=dword:00000002 >>2000.reg
echo [HKEY_USERS.DEFAULTKeyboard LayoutToggle] >>2000.reg
echo "Hotkey"="1" >>2000.reg
echo [HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlTerminal ServerWds
dpwdTds cp] >>2000.reg
echo "PortNumber"=dword:00000D3D >>2000.reg
echo [HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlTerminal ServerWinStationsRDP-Tcp] >>2000.reg
echo "PortNumber"=dword:00000D3D >>2000.reg
6.强行重启Win2000&Win2003系统(执行完最后一条一句后自动重启)
@ECHO OFF & cd/d %temp% & echo [version] > restart.inf
(set inf=InstallHinfSection DefaultInstall)
echo signature=$chicago$ >> restart.inf
echo [defaultinstall] >> restart.inf
rundll32 setupapi,%inf% 1 %temp%
estart.inf
7.禁用TCP/IP端口筛选 (需重启)
REG ADD HKLMSYSTEMControlSet001ServicesTcpipparameters /v EnableSecurityFilters /t REG_DWORD /d 0 /f
8.终端超出最大连接数时可用下面的命令来连接
mstsc /v:ip:3389 /console
9.调整NTFS分区权限
cacls c: /e /t /g everyone:F (所有人对c盘都有一切权利)
cacls %systemroot%system32*.exe /d everyone (拒绝所有人访问system32中exe文件)
------------------------------------------------------
3389.vbs cscript.exe
------------------------------------------------------
const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set StdOut = WScript.StdOut
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\" &_
strComputer & " ootdefault:StdRegProv")
strKeyPath = "SYSTEMCurrentControlSetControlTerminal Server"
oReg.CreateKey HKEY_LOCAL_MACHINE,strKeyPath
strKeyPath = "SYSTEMCurrentControlSetControlTerminal ServerWds dpwdTds cp"
oReg.CreateKey HKEY_LOCAL_MACHINE,strKeyPath
strKeyPath = "SYSTEMCurrentControlSetControlTerminal ServerWinStationsRDP-Tcp"
strKeyPath = "SYSTEMCurrentControlSetControlTerminal Server"
strValueName = "fDenyTSConnections"
dwValue = 0
oReg.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,dwValue
strKeyPath = "SYSTEMCurrentControlSetControlTerminal ServerWds dpwdTds cp"
strValueName = "PortNumber"
dwValue = 3389
oReg.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,dwValue
strKeyPath = "SYSTEMCurrentControlSetControlTerminal ServerWinStationsRDP-Tcp"
strValueName = "PortNumber"
dwValue = 3389
oReg.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,dwValue
Set R = CreateObject("WScript.Shell")
R.run("Shutdown.exe -r -t 0")