用 PowerShell 把网络从"公用"改为"专用"
网络被识别成"公用"导致共享和打印机用不了?用 Set-NetConnectionProfile 一条命令改成"专用"。
以管理员身份运行 PowerShell,执行 Set-NetConnectionProfile -InterfaceAlias "WLAN" -NetworkCategory Private;先用 Get-NetConnectionProfile 查看当前状态。
01命令
命令
$ Set-NetConnectionProfile -InterfaceAlias "Wi-Fi" -NetworkCategory Private02作用说明
Windows 对"公用"和"专用"网络套用不同的防火墙规则:公用网络默认禁止文件共享和设备发现,专用网络才允许。如果家里的 Wi-Fi 被误判成公用,别的设备就看不到你这台电脑,共享文件夹和打印机也连不上。Set-NetConnectionProfile 按网卡名直接改网络类别,立即生效,不用重启。改之前用 Get-NetConnectionProfile 确认网卡名和当前类别。
03风险
!注意: 只把可信的网络(家里、公司)设为专用;咖啡馆、酒店这种公共 Wi-Fi 保持公用更安全,公用模式的限制是故意的。
04撤销
撤销
$ Set-NetConnectionProfile -InterfaceAlias "Wi-Fi" -NetworkCategory Public05来源
- Set-NetConnectionProfile依据: Set-NetConnectionProfile changes NetworkCategory between Public, Private (and DomainAuthenticated) for the adapter named by -InterfaceAlias.
最后验证: 2026-09-18 · 分类: 系统与设置