Configure Windows Firewall on a Windows VPS
Check Windows Firewall profiles, inspect RDP rules, create a safe test inbound rule, and clean it up on a Raff Windows Server VPS.

On this page
- In short
- Quick verdict
- Why Windows Firewall matters on a VPS
- What we tested on Raff
- Step 1 - Check Windows Firewall profiles
- Step 2 - Review existing RDP firewall rules
- Step 3 - Create a safe temporary test rule
- Step 4 - Remove the temporary test rule
- Step 5 - Use narrower rules for real workloads
- Common ports and what to do with them
- Recommended firewall workflow
- Useful firewall commands
- Common mistakes
- What Raff recommends
- FAQ
- Tested on
- What's next
- Sources
Don't have a Windows Server yet?
Deploy Windows Server 2019/2022/2025 in ~2 minutes. 6-month evaluation licence included.
In short
Windows Firewall is the first control layer between your Windows VPS and unwanted network traffic. On a production server, leave the firewall enabled, review exposed inbound rules, allow only the ports your workload needs, and remove test rules after validation. This guide shows how to check firewall profiles, inspect RDP rules, create a safe test inbound rule, and clean it up on a Raff Windows Server VPS.
Quick verdict
| Task | Recommended action |
|---|---|
| Check if Windows Firewall is enabled | Use Get-NetFirewallProfile |
| Review RDP exposure | Inspect the Remote Desktop rule group |
| Open a production port | Create a narrow inbound rule for that exact port |
| Test a firewall change | Use a temporary rule and remove it afterward |
| Expose SQL Server, IIS, or app ports | Allow only required sources where possible |
| Unsure whether a rule is needed | Do not open the port until the service requires it |
Default rule: block inbound traffic unless you have a clear reason to allow it.
Why Windows Firewall matters on a VPS
A Windows VPS is reachable over the network. That makes firewall configuration part of the server’s security baseline.
Windows Firewall is a host-based firewall included with Windows. It controls inbound and outbound traffic on the machine itself. Microsoft documents Windows Firewall as enabled by default and designed to help filter network traffic by profile, rule, application, port, and other conditions.
For SMB workloads, firewall mistakes usually happen in one of two ways:
- Too many inbound ports are opened “just in case.”
- Important rules are changed without checking what already exists.
Both are avoidable.
A good Windows VPS firewall setup follows this rule:
Open only what the workload needs, keep RDP controlled, document every custom rule, and remove test rules after testing.
What we tested on Raff
We tested this walkthrough on a Raff Windows VPS running Windows Server 2025 Datacenter Evaluation.


Test environment:
| Item | Value |
|---|---|
| Provider | Raff Technologies |
| OS | Windows Server 2025 Datacenter Evaluation |
| Build | 26100 |
| CPU | 4 vCPU |
| RAM | Approximately 8 GB |
| Test date | 2026-05-24 |
| Tester | Aybars Altinyay |
On this VM, we verified:
- Windows Server version and hardware details
- Firewall profile status
- Existing RDP firewall rules
- Creation of a temporary inbound TCP rule
- Cleanup/removal of the temporary test rule
We did not expose a production application port in this test. The custom rule used TCP 54321 only as a temporary demonstration rule.
Step 1 - Check Windows Firewall profiles
Start by checking the firewall profiles.
Run PowerShell as Administrator:
powershellGet-NetFirewallProfile | Select-Object Name, Enabled, DefaultInboundAction, DefaultOutboundAction
You should see the main profiles:
- Domain
- Private
- Public
In our Raff test, all three profiles were enabled.

If the Enabled column shows True, the firewall profile is active.
If DefaultInboundAction or DefaultOutboundAction shows NotConfigured, that means no explicit local default action is set in that policy view. Do not treat that as the firewall being disabled. Check the Enabled column first.
Step 2 - Review existing RDP firewall rules
Remote Desktop is the most important firewall rule group on many Windows VPS deployments.
Run:
powershellGet-NetFirewallRule -DisplayGroup "Remote Desktop" |
Select-Object DisplayName, Enabled, Direction, Action, Profile |
Format-Table -AutoSize

Review:
| Field | Meaning |
|---|---|
DisplayName | Human-readable firewall rule name |
Enabled | Whether the rule is active |
Direction | Inbound or outbound |
Action | Allow or block |
Profile | Domain, Private, Public, or Any |
For production servers, RDP deserves special care. If possible, restrict RDP access to known IP addresses, a VPN, or a trusted administrative network. Do not leave broad public RDP exposure unless you have a deliberate operational reason and additional controls.
Step 3 - Create a safe temporary test rule
For this guide, we created a harmless demonstration rule for TCP port 54321.
This shows the syntax for creating a firewall rule without exposing a real production service like SQL Server or IIS.
Run:
powershellNew-NetFirewallRule -DisplayName "Raff Test Inbound Rule TCP 54321" -Direction Inbound -Protocol TCP -LocalPort 54321 -Action Allow -Profile Any
Then verify the rule:
powershellGet-NetFirewallRule -DisplayName "Raff Test Inbound Rule TCP 54321" |
Select-Object DisplayName, Enabled, Direction, Action, Profile

This command creates an inbound allow rule.
Important: opening a firewall port does not automatically mean an application is listening on that port. A service still needs to bind to the port before traffic can reach an application. The firewall rule only controls whether Windows allows the traffic through.
Step 4 - Remove the temporary test rule
Do not leave test rules behind.
Remove the rule:
powershellRemove-NetFirewallRule -DisplayName "Raff Test Inbound Rule TCP 54321"
Then verify cleanup:
powershellif (Get-NetFirewallRule -DisplayName "Raff Test Inbound Rule TCP 54321" -ErrorAction SilentlyContinue) {
Write-Output "Test firewall rule still exists"
} else {
Write-Output "Test firewall rule removed"
}

A clean firewall is easier to audit. Temporary rules should not survive the test session.
Step 5 - Use narrower rules for real workloads
For production, avoid broad rules when a narrower one works.
A broad rule looks like this:
powershellNew-NetFirewallRule -DisplayName "Allow App Port" -Direction Inbound -Protocol TCP -LocalPort 8080 -Action Allow -Profile Any
A better rule restricts the source IP:
powershellNew-NetFirewallRule `
-DisplayName "Allow App Port 8080 from Office IP" `
-Direction Inbound `
-Protocol TCP `
-LocalPort 8080 `
-RemoteAddress 203.0.113.10 `
-Action Allow `
-Profile Any
Use source restrictions for admin ports, database ports, internal APIs, and management tools whenever possible.
Common ports and what to do with them
| Port | Service | Recommendation |
|---|---|---|
| TCP 3389 | RDP | Restrict if possible; monitor closely |
| TCP 80 | HTTP / IIS | Open only if hosting a public website |
| TCP 443 | HTTPS / IIS | Open for public HTTPS websites and APIs |
| TCP 1433 | SQL Server | Do not expose publicly; restrict to trusted IPs |
| TCP 445 | SMB file sharing | Avoid exposing to the public internet |
| TCP 5985 | WinRM HTTP | Avoid public exposure |
| TCP 5986 | WinRM HTTPS | Restrict to admin IPs or VPN |
| Custom app ports | Business applications | Open only the exact required port and source |
If a workload does not require an inbound port from the internet, do not open it.
Recommended firewall workflow
Use this workflow when changing Windows Firewall on a production VPS:
- Identify the application and required port.
- Confirm whether the service is actually listening.
- Decide who needs access.
- Create the narrowest possible allow rule.
- Test from the expected client network.
- Document the rule name, port, protocol, and reason.
- Remove temporary or failed test rules.
- Review custom rules monthly.
For example, if a SQL Server instance only needs access from your office IP, do not open TCP 1433 to the entire internet. Allow the office IP only.
Useful firewall commands
List all enabled inbound allow rules
powershellGet-NetFirewallRule |
Where-Object { $_.Enabled -eq "True" -and $_.Direction -eq "Inbound" -and $_.Action -eq "Allow" } |
Select-Object DisplayName, Profile, Direction, Action |
Format-Table -AutoSize
Find rules by name
powershellGet-NetFirewallRule | Where-Object DisplayName -like "*RDP*"
Disable a rule without deleting it
powershellDisable-NetFirewallRule -DisplayName "Rule Name"
Enable a disabled rule
powershellEnable-NetFirewallRule -DisplayName "Rule Name"
Remove a rule
powershellRemove-NetFirewallRule -DisplayName "Rule Name"
Check whether a port is listening
powershellGet-NetTCPConnection -State Listen | Select-Object LocalAddress, LocalPort, OwningProcess
This helps separate firewall problems from application problems. If no service is listening, opening the firewall is not enough.
Common mistakes
Opening ports before confirming the service needs them
Do not open ports because an installation guide mentioned them. Confirm the service, protocol, and source first.
Exposing SQL Server to the public internet
SQL Server should normally be restricted to trusted IPs, private networking, VPN, or application servers. Public TCP 1433 exposure increases risk.
Leaving temporary test rules behind
Temporary rules become permanent risk when nobody removes them. Use clear names like Raff Test..., then delete them after testing.
Changing RDP rules without a backup access path
If you lock yourself out of RDP, you may need dashboard or console recovery. Be careful when changing RDP rules on a remote VPS.
Assuming the firewall is the only security layer
Firewall rules are important, but they do not replace strong passwords, patching, least privilege, MFA where available, application hardening, and monitoring.
What Raff recommends
For production Windows VPS workloads, Raff recommends:
- Keep Windows Firewall enabled.
- Keep RDP rules under strict control.
- Restrict admin ports to trusted IPs where possible.
- Avoid exposing database and file-sharing ports publicly.
- Use HTTPS for public web workloads.
- Name custom rules clearly.
- Remove temporary rules after testing.
- Review firewall rules after every major software install.
The best firewall rule is the one you do not need to create. Start closed, then open only what the workload requires.
FAQ
Should I disable Windows Firewall on a VPS?
No. Keep it enabled. If something does not connect, fix the specific rule instead of turning the firewall off.
Why does my firewall profile show NotConfigured?
That value means a specific default action is not explicitly configured in that policy view. It does not mean the firewall is disabled. Check the Enabled column for each profile.
Is opening a port enough for an application to work?
No. The application must also be running and listening on that port. Use Get-NetTCPConnection -State Listen to check listening ports.
Should RDP be open to everyone?
Avoid that when possible. Restrict RDP to known IP addresses, VPN, or trusted admin networks if your workflow allows it.
Can I use the GUI instead of PowerShell?
Yes. Windows Defender Firewall with Advanced Security provides a GUI for creating and editing rules. PowerShell is faster for repeatable server administration.
Tested on
Tested on Raff Windows VPS, Windows Server 2025 Datacenter Evaluation, build 26100, 4 vCPU, approximately 8 GB RAM, 2026-05-24. We verified firewall profile status, existing Remote Desktop firewall rules, creation of a temporary inbound TCP rule, and removal of that test rule. Tester: [ENGINEER NAME].
What's next
- Windows Update Strategy on Production Servers - patch Windows Server safely with snapshots and maintenance windows
- Connect to a Raff Windows VPS via RDP - connect to your Windows Server from Windows, macOS, Linux, iOS, and Android
- Raff Windows Server Hub - browse Windows Server guides, compatibility notes, PowerShell commands, and version comparisons
- Raff Windows VPS - deploy a Windows Server VPS for business software, SQL Server, IIS, RDP, or admin workloads
Sources
- Microsoft Learn - Windows Firewall overview
- Microsoft Learn - Manage Windows Firewall with the command line
- Microsoft Learn - Get-NetFirewallProfile
- Microsoft Learn - New-NetFirewallRule
- Microsoft Learn - NetSecurity PowerShell module
Related articles
Windows Update Strategy on Production Servers
Update Windows Server safely on a production VPS: snapshot first, patch on a controlled schedule, scan with PowerShell, and verify reboot state.
Windows Server Hardening Checklist: Secure Your VPS Before Production
Harden a Windows Server VPS before production with practical checks for accounts, RDP, firewall rules, Defender, audit logging, updates, and services.
SQL Server 2025 Security Hardening on a Windows Server VPS (2026 MSP Guide)
Step-by-step SQL Server 2025 hardening on a Windows Server VPS: disable sa, least-privilege app logins, SQL Server Audit, TCP/IP enable, firewall scoping, and Let's Encrypt cert replacement. End-to-end MSP guide tested on Raff.