积极答复者
除了Ipconfig /all还有什么命令可以查询计算机本地DNS配置的?

问题
答案
-
看看这个脚本可以不可以满足您的需求,测试了一下可以检索出域内客户端以及服务器上所有的DNS配置信息:
$AllServers=Get-ADComputer -Filter {OperatingSystem -Like "Windows*"} ForEach ($Server in $AllServers){ $Result=Get-WmiObject -Class Win32_NetworkAdapterConfiguration -Filter "IPEnabled = 'True'" -Property DNSServerSearchOrder -ComputerName $Server.Name $output = new-object PSObject $output | add-member NoteProperty "ComputerName" $Server.Name $output | add-member NoteProperty "DNSServerSearchOrder" $Result.DNSServerSearchOrder $output }
参考的以下脚本链接:
Check the DNS Settings for all Windows Servers
Please remember to mark the replies as an answers if they help.
If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com- 已编辑 Candy LuoMicrosoft contingent staff, Moderator 2021年4月2日 9:22 修改格式
- 已标记为答案 谷青松 2021年4月6日 7:46
全部回复
-
Hi,
CMD命令中通常是用ipconfig /all来查询计算机本地DNS配置。Powershell通常用Get-DNSClientServerAddress 来查看网卡上DNS的IP信息。
以下是powershell里Get-DNSClientServerAddress 命令的官方使用方法链接,供你参考。
https://docs.microsoft.com/en-us/powershell/module/dnsclient/get-dnsclientserveraddress?view=windowsserver2019-ps
如果回复对您有所帮助的话,请您把回复标记为答复,方便论坛中其他有相同问题的用户快速找到有帮助的回复。
此致
Mulder
-
Hello,您说的检查主机dns配置的脚本具体是指什么?可以阐述更清楚一些方便我们了解您的需求吗?
如果您是想要查看当前计算机本地DNS配置,可以通过IPconfig /all的CMD命令或者是Get-DNSClientServerAddress的powershell命令来查看。
或者说您是想要有一个检查的脚本,用来列举当前域内所有客户端的DNS配置信息?不清楚我的理解是否正确,如果有误会,请随时纠正我的理解。
Please remember to mark the replies as an answers if they help.
If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com- 已编辑 Candy LuoMicrosoft contingent staff, Moderator 2021年4月2日 8:52
-
看看这个脚本可以不可以满足您的需求,测试了一下可以检索出域内客户端以及服务器上所有的DNS配置信息:
$AllServers=Get-ADComputer -Filter {OperatingSystem -Like "Windows*"} ForEach ($Server in $AllServers){ $Result=Get-WmiObject -Class Win32_NetworkAdapterConfiguration -Filter "IPEnabled = 'True'" -Property DNSServerSearchOrder -ComputerName $Server.Name $output = new-object PSObject $output | add-member NoteProperty "ComputerName" $Server.Name $output | add-member NoteProperty "DNSServerSearchOrder" $Result.DNSServerSearchOrder $output }
参考的以下脚本链接:
Check the DNS Settings for all Windows Servers
Please remember to mark the replies as an answers if they help.
If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com- 已编辑 Candy LuoMicrosoft contingent staff, Moderator 2021年4月2日 9:22 修改格式
- 已标记为答案 谷青松 2021年4月6日 7:46
-
您看看我给您发的脚本,可以检索域内所有windows的系统,直接看出所有的windows机器上是否有配置首选DNS以及次选DNS,并且相对应的IP地址也有。
查首选dns和次选dns地址,看有没有设立的脚本,好像并没有找到。应该是可以实现,但是这个需要进行脚本编写了。
我觉得上面那个脚本还算是挺方便的,您可以测试一下。
Please remember to mark the replies as an answers if they help.
If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com -
Hi,请问目前问题是否需要进行更进?请随时让我了解最新的进展。
Please remember to mark the replies as an answers if they help.
If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com