Modify 3389 Remote Desktop port tips and gadget making

Source: Internet
Author: User
Tags port number firewall

How do I modify a port?

Modify the server-side port settings and the registry has 2 places to modify. [Hkey_local_machinesystemcurrentcontrolsetcontrolterminal Serverwdsrdpwdtdstcp] The PortNumber value, which defaults to 3389, is modified to the desired port, as you said it would be 6222. Second place: [hkey_local_machinesystemcurrentcontrolsetcontrolterminal serverwinstationsrdp-tcp] portnumber value, default is 3389, Modify to the desired port, the 6222, the restart will be OK. That's it, okay?

Note that you must add the modified port number in the firewall exception if you want to continue using Remote Desktop after your computer has finished modifying the port number and the computer has a firewall enabled. Otherwise, both 3389 and the modified port number will not connect to the Remote Desktop.

Those who use foreign service cannot afford to hurt:

After years of practice, come true, due to the interference of the Greater China Firewall, Remote Desktop Connection to foreign servers, will often cause 3389-port communication is blocked, and other access is normal, including server Web site access (of course, there are intermittent shielding 80-port things happen).

Because I have two servers, most is a normal, the other does not, on the remote to an internal and remote past.

Sometimes it's a wonder when you can't even meet two.

Suddenly came the consciousness:

Recently realized suddenly, since 3389 is the default blocked, then the port has been changed, after the reform, remote smoothly, the mood also let go, the server security also improved.

How to change?

Directly modify the registry, write code are afraid of trouble, online download gadgets use it, write code are afraid of unsafe.

So, anyway, it's simple, brush a few minutes, write your own, the code on a paragraph:

public static void Change (int port)

{

Try

{

RegistryKey Runkey = Registry.LocalMachine.OpenSubKey (@ "systemcurrentcontrolsetcontrolterminal Serverwdsrdpwdtdstcp ", true);

if (Runkey!= null)

{

Runkey.setvalue ("PortNumber", port);

Runkey.close ();

}

Runkey = Registry.LocalMachine.OpenSubKey (@ "Systemcontrolset001controlterminal serverwinstationsrdp-tcp", true); Win7

if (Runkey!= null)

{

Runkey.setvalue ("PortNumber", port);

Runkey.close ();

}

Runkey = Registry.LocalMachine.OpenSubKey (@ "Systemcurrentcontro1setcontroltenninal serverwinstationsrdptcp", true) ;//win2003

if (Runkey!= null)

{

Runkey.setvalue ("PortNumber", port);

Runkey.close ();

}

MessageBox.Show ("Modified successfully, restart the computer after the effective.") ");

}

catch (Exception err)

{

MessageBox.Show (Err. message);

}

}

After tossing the WinForm tool the following figure, a code, mainly to avoid their own delays, modify the code to fill up. com, to strengthen their memory:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.