在 Windows 上按网卡查看 DNS 服务器地址
使用内置 DNSClient PowerShell 模块列出每个网络接口配置的 DNS 服务器,输出按适配器分组、清晰易读。
在 PowerShell 中运行 Get-DnsClientServerAddress 即可查看每个网络接口所配置的 DNS 服务器。
01命令
命令
$ Get-DnsClientServerAddress -AddressFamily IPv4 | Format-Table InterfaceAlias,InterfaceIndex,ServerAddresses -AutoSize02作用说明
Get-DnsClientServerAddress 是 NetTCPIP 系列的现代 cmdlet,比在 ipconfig /all 输出里费力查找要清楚得多。它能区分适配器级和连接特定的 DNS 设置,并支持用 -AddressFamily 过滤掉 IPv6 噪音。按 InterfaceIndex 过滤还可以写成脚本做针对性检查,例如确认 VPN 适配器没有覆盖公司内网解析器。
03风险
04撤销
✓无需撤销——该命令不会改变持久状态。
05来源
- Get-DnsClientServerAddress | Microsoft Learn依据: Microsoft documents Get-DnsClientServerAddress as the cmdlet that retrieves DNS server addresses configured on the computer, filtered by AddressFamily and interface.
最后验证: 2026-09-17 · 分类: 网络