三二互联专业提供速度最快最稳定的美国服务器、香港服务器。中美直连,亚洲优化![ 代理登陆 ] [ 付款方式 ] [ 找回密码 ][ 电子协议责任书 ]
硬件资源保障

采用高配品牌服务器

主流强悍CPU配置

确保服务高速稳定运行

中美直连线路

中美直连亚洲优化

采用中国CN2骨干网络

保证速度飞快稳定高效

如何在PowerShell中添加出站规则?

美国、香港服务器

如何在PowerShell中添加出站规则?

09-24   来源:

 ## 1. 放行指定远程端口(TCP,示例:出站 443 HTTPS)

 
New-NetFirewallRule -DisplayName "Outbound_Allow_HTTPS_443" `
-Direction Outbound `
-Action Allow `
-Protocol TCP `
-RemotePort 443 `
-Enabled True `
-Profile Any
 
参数说明:
 
- `-Direction Outbound`:出站规则
- `-RemotePort`:**目标端口(对外访问的端口)**,出站不要写 LocalPort,容易搞反
- `-Profile Any`:域 / 专用 / 公用全部生效;可改为 Domain,Private
 
## 2. 放行多个端口(80,443,53)
 
New-NetFirewallRule -DisplayName "Outbound_Allow_Web_DNS" `
-Direction Outbound `
-Action Allow `
-Protocol TCP `
-RemotePort 80,443,53 `
-Enabled True `
-Profile Any
 
## 3. UDP 端口示例(DNS UDP53)
 
New-NetFirewallRule -DisplayName "Outbound_Allow_DNS_UDP53" `
-Direction Outbound `
-Action Allow `
-Protocol UDP `
-RemotePort 53 `
-Enabled True `
-Profile Any
 
## 4. 只允许访问指定远端 IP(白名单 IP 出站)
 
仅允许服务器出站访问 `114.114.114.114`
 
New-NetFirewallRule -DisplayName "Outbound_Allow_DNS_114.114.114.114" `
-Direction Outbound `
-Action Allow `
-Protocol UDP `
-RemoteAddress 114.114.114.114 `
-RemotePort 53 `
-Enabled True `
-Profile Any
 
## 5. 放行 RDP 出站(服务器主动对外 RDP)
 
New-NetFirewallRule -DisplayName "Outbound_Allow_RDP_3389" `
-Direction Outbound `
-Action Allow `
-Protocol TCP `
-RemotePort 3389 `
-Enabled True `
-Profile Any
 
# ✅ 查看新建的出站规则,验证是否创建成功
 
Get-NetFirewallRule -Direction Outbound | Where-Object {$_.DisplayName -match "Outbound"}
 
# 🗑 删除规则(应急,规则名替换)
 
Remove-NetFirewallRule -DisplayName "Outbound_Allow_HTTPS_443"

三二互联专业提供香港VPS,美国VPS主机,香港云服务器租用等业务香港美国到大陆CN2 GIA速度最快

上一篇:如何在PowerShell中查看已有的出站规则? 下一篇:如何验证基础出站放行规则是否生效?

美国GIA服务器三二互联版权所有 WWW.250.cc 2008-2015 All Rights Reserved
三二互联 - 专业的美国C3服务器、香港vps、抗DOOS流量清洗、云备份系统、网站加速系统、美国GIA服务器和香港云服务器产品提供商
三二互联24小时在线工单系统为您提供全面、专业、周到的技术支持与服务
咨询热线:400-679-9994(免长话费)