VBScript - 修改遠端桌面連線登入 Port 號

功能說明

此 VBScript 程式功能為修改遠端桌面連線登入 (Terminal Service) 預設 Port Number(3389),下列 VBScript 將遠端桌面連線登入 Port Number 改為 16888



實作環境

  • Windows 2000 Server (測試成功)
  • Windows XP Professional (測試成功)

TSPortNumberChanged.vbs 內容

Dim Path
Path1="HKLM\SYSTEM\CurrentControlSet\Control\Terminal  Server\Wds\rdpwd\Tds\tcp\"
Path2="HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp\"
Set ws=WScript.CreateObject("WScript.Shell")
ws.RegWrite Path1&"PortNumber",16888,"REG_DWORD"
ws.RegWrite Path2&"PortNumber",16888,"REG_DWORD"