Remember to maintain security and privacy. Do not share sensitive information. Procedimento.com.br may make mistakes. Verify important information. Termo de Responsabilidade

A Comprehensive Guide to Using PowerShell Script to Open Port 3389 on Windows Firewall

In this guide, we will explore the process of using a PowerShell script to open port 3389 on the Windows Firewall. Opening this port is essential for enabling Remote Desktop Protocol (RDP) connections to a Windows machine. By following the steps provided, you will be able to configure your Windows Firewall to allow RDP traffic through port 3389, facilitating remote access to your Windows system.


Examples:


1. First, open PowerShell with administrative privileges. To do this, press the Windows key, type "PowerShell," right-click on "Windows PowerShell," and select "Run as administrator."


2. Once PowerShell is open, use the following command to check if port 3389 is already open on your Windows Firewall:


Get-NetFirewallRule | Where-Object {$_.LocalPort -eq 3389}

If the output shows a rule named "Remote Desktop - User Mode (TCP-In)" or similar, it means that port 3389 is already open. You can skip to step 6.


3. If the port is not open, you need to create a new inbound rule to allow traffic through port 3389. Use the following command to create the rule:


New-NetFirewallRule -DisplayName "Remote Desktop - User Mode (TCP-In)" -Direction Inbound -Protocol TCP -LocalPort 3389 -Action Allow

4. After executing the command, check if the new rule was created successfully by running the command from step 2 again.


5. If the rule was created successfully, you can now connect to your Windows machine using RDP through port 3389.


6. In case you want to remove the rule and close port 3389, use the following command:


Remove-NetFirewallRule -DisplayName "Remote Desktop - User Mode (TCP-In)"

Remember to always exercise caution when opening ports on your Windows Firewall, as it can expose your system to potential security risks. Only open the necessary ports and ensure that your system is properly protected with up-to-date security measures.


To share Download PDF