Home > Windows > Change windows 2008 RDP Port from command line

Change windows 2008 RDP Port from command line

You can follow the steps mentioned below to change the windows 2008 rdp port from command line. The windows “reg” command is used for this purpose.

1) Start command prompt by typing “cmd” in Run .

2) To get the current RDP port number.

REG QUERY "HKLM\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" /v PortNumber

The above command will display RDP port in hexadecimal format. To convert from hexadecimal to decimal use the python interpreter or some other tools you like,

u1@h1:~$ python -c "print int(0xd3d)"

3) If you want to change the port number to 10000, convert it to hexadecimal format as follows,

u1@h1:~$ python -c "print hex(10000)"

Overwrite the data section of key value PortNumber with the new port number(0x2710 = 10000 ).

REG ADD "HKLM\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" /v PortNumber /t REG_DWORD /d 0x2710 /f

4) Now restart terminal services. If you are logged in using rdp, then
better restart terminal services from “services.msc”

NOTE: Before restarting terminal services make sure that new rdp port is opened in firewall.

net stop TermService /y
net start TermService /y

That’s it:)

Now verify that its running using “netstat”

netstat -ano|findstr /i "10000"
Categories: Windows
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: