我有一个行为不端的DNS服务器.
我的一些Windows机器只有2个DNS服务器
server01 192.0.2.1 server02 192.0.2.2
我的一些Windows机器有3个dns服务器
server01 192.0.2.1 server02 192.0.2.2 server03 192.0.2.3
如何使用PowerShell从我的DNS设置中删除server03(192.0.2.3)?
PS C:\Windows\system32> Get-DnsClientServerAddress InterfaceAlias Interface Address ServerAddresses Index Family -------------- --------- ------- --------------- Ethernet 2 12 IPv4 {192.0.2.1,192.0.2.2,192.0.2.3} Ethernet 2 12 IPv6 {} Loopback Pseudo-Interface 1 1 IPv4 {}
我的窗户经验非常少.在linux上,我会编辑resolv.conf
更新这些是Windows 2012 R2服务器
见
http://blogs.technet.com/b/heyscriptingguy/archive/2012/02/28/use-powershell-to-configure-static-ip-and-dns-settings.aspx
原文链接:https://www.f2er.com/windows/367719.html$wmi = Get-WmiObject win32_networkadapterconfiguration -filter "ipenabled = 'true'" $DnsServers = "192.0.2.1","192.0.2.2" $wmi.SetDNSServerSearchOrder($DnsServers)