Remote Desktop Port Change

|
'Kelly Theriot 11-2004
'Kelly's Korner

Option Explicit

Set ws = WScript.CreateObject("WScript.Shell")
Dim ws, t, p1, n, cn, MyBox, vbdefaultbutton
Dim itemtype

p1 = "HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlTerminal ServerWinStationsRDP-Tcp"

n = ws.RegRead(p1 & "PortNumber")
t = "Change Port Number"
cn = InputBox("Type in the new port number", t, n)
If cn <> "" Then
  ws.RegWrite p1 & "PortNumber", cn
End If

MyBox = MsgBox("Once done hit refresh (F5) for the changes to take effect.", vbOKOnly,"Done")
Originally Posted on July 18, 2013
Last Updated on October 26, 2015
All information on this site is shared with the intention to help. Before any source code or program is ran on a production (non-development) system it is suggested you test it and fully understand what it is doing not just what it appears it is doing. I accept no responsibility for any damage you may do with this code.