I was able to use my remote desktop with custom port when I was using Kaspersky Internet Security. Now, I have uninstalled my Kaspersky and switch to Avast!. Therefore, the windows firewall is turned on back again. However, after the firewall is turned on, I cannot connect to the remote desktop. I have set the remote desktop "checked" in the windows firewall as shown by here: http://windows.microsoft.com/en-my/windows7/use-remote-desktop-when-windows-firewall-is-on.

So, I am guessing it is caused by the custom port setting of my remote desktop. So, how can I unblock that on firewall to make my remote desktop works again?

Thank you.

  • 1
    You are essentially asking how do you add a port to the windows firewall. (which would be windows firewall behaving as one would want from a firewall!)
    – barlop
    Mar 3, 2014 at 9:20

4 Answers 4


To open custom port in Windows Firewall, you can do the following:

  1. In your Windows Firewall in Control Panel, click on the Advanced Settings option on the left.
  2. In the Windows Firewall with Advanced Security window that opens, click on the Inbound Rules on the left.
  3. Click on the New Rule on the right side of the window.
  4. Select Port on the list of options.
  5. Select TCP (or UDP if that is what you require) and Specific local ports, and then write your ports in the text box to the right of Specific local ports (i.e. 1234).
  6. Select Allow the connection in the next window.
  7. Select the options which you need from Domain, Private, Public (private and public are the network types that you select when you connect to the new network, and windows asks you to select the network type, and domain is obviously your domain).
  8. Finally, write a Name and Description in the window that shows next. Click FINISH.

Your port should be now allowed through the Windows Firewall.

  • I would like to highlight step #2-#8!!!! I have spent hours after having opened ports through my home router, only to get confused about why none of my other Windows PC with customized ports should be inaccessible for RDP without having disabled the firewall completely.
    – llinfeng
    Dec 10, 2018 at 4:41
  • If you want to limit the port to RDP access, you should specify "Remote Desktop Services" under Programs&Services->Services. Aug 31, 2019 at 16:06

If you changed the RDP listening port you will need to create a custom Windows firewall rule to listen on that port.

Create a firewall rule for new port:

  • Open Windows Firewall with Advanced Security
    1. Create a new rule
    2. Select "Inbound Rules" on the top left
    3. Right-click and select "New Rule…"
    4. A new "Inbound Rule Wizard" window opens
    5. Select "Program"
    6. click Next
    7. Select “This program path:”
    8. Type System in the text field
    9. Click Next
    10. Select “Allow the connection”
    11. Click Next
    12. Choose the profiles that the rule is for
    13. Click Next
    14. Name the new rule
    15. I would use something like “RDP3390” or whatever the new port number is
    16. Click "Finish"
    17. Test your port by going to www.whatsmyip.org and use their port scanner. You should be able to turn the rule off and off the scan fail.

To complete the previous answers I must add the following:

In case that you want to connect to a Virtualbox machine through a RDP custom port you have to disabled the "Virtual Box Manager" default rule, who is blocking all the connection to the Virtual Box Software, without this, the inbound rules that you add will not work.


Just in case anyone is still having difficulty with this, this is what I had to do...

Windows 10 creates 3 inbound firewall rules when you set options for remote desktop. You need to create 3 new rules exactly like those 3 rules except you must specify your new custom port instead.

The 3 rules are:

Remote Desktop - Shadow (TCP-In)

Remote Desktop - User Mode (TCP-In)

Remote Desktop - User Mode (UDP-In)

you cannot copy and paste them so you must read them and then create from scratch as program rules in Inbound rules and edit accordingly.

Then when you have done that you must disable the above 3 microsoft rules which point to port 3389.

Good luck!

  • Hi @percept, would you mind mentioning where to view and create the rules? Dec 7, 2019 at 1:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .