Powershell - View and manage DNS configuration of network interfaces
To support me, you can subscribe to the channel, share and like the videos, disable your ad blocker or make a donation. Thank you!
Hello,
Still on the subject of networking, here’s a set of commands for displaying and modifying the DNS configuration of network interfaces
# Display DNS cache (ipconfig /displaydns)Get-DnsClientCache
# Display DNS cache items with a specific lifetimeGet-DnsClientCache -TimeToLive 86400
# Display specific DNS cache resource records (A, PTR, CNAME...)Get-DnsClientCache -Type A
# Display failed DNS cache itemsGet-DnsClientCache -Status NoRecords
# Display DNS cache items filtered by record nameGet-DnsClientCache -Entry www.altf4-formation.fr
# Display DNS cache items filtered by record valueGet-DnsClientCache -Data 192.168.0.254
# Clear dns cache (ipconfig /flushdns)Clear-DnsClientCache
# Display DNS suffixes, DNS suffix lookup list and whether interface registers with DNS serverGet-DnsClient
# Display DNS suffixes for a specific network interface, the DNS suffix lookup list and whether the interface registers with the DNS serverGet-DnsClient -InterfaceAlias Ethernet
# Displays interfaces configured to register with the DNS serverGet-DnsClient -RegisterThisConnectionsAddress $true
# Displays interfaces configured to register with the DNS server using a DNS suffixGet-DnsClient -UseSuffixWhenRegistering $true
# Displays interfaces configured with a specific DNS suffixGet-DnsClient -ConnectionSpecificSuffix home
# Disable DNS registration for network interfaceSet-DnsClient -InterfaceAlias ethernet -RegisterThisConnectionsAddress $false
# Set DNS suffix for interfaceSet-DnsClient -InterfaceAlias ethernet -ConnectionSpecificSuffix
# Remove DNS suffix for network interfaceSet-DnsClient -InterfaceAlias ethernet -ResetConnectionSpecificSuffix
# Enable use of DNS suffix for registrationSet-DnsClient -InterfaceAlias ethernet -UseSuffixWhenRegistering $true
# Register ip with DNS server (ipconfig /registerdns)Register-DnsClient
# Display list of DNS servers configured on network interfacesGet-DnsClientServerAddress
# Display list of DNS servers configured on a specific network interfaceGet-DnsClientServerAddress -InterfaceAlias Ethernet
# Display DNS-over-HTTPS (DoH) configurationGet-DnsClientDohServerAddress
# Display global DNS client configurationGet-DnsClientGlobalSetting
# Display DNS client NRPT configurationGet-DnsClientNrptGlobal
# Reset DNS server settingsGet-DnsClient | Set-DnsClientServerAddress -ResetServerAddresses
# Set DNS on a network interfaceSet-DnsClientServerAddress -InterfaceAlias Ethernet -ServerAddresses 192.168.0.254,192.168.0.253
# Set DNS on a network interface, checking that the IP addresses set are DNS serversSet-DnsClientServerAddress -InterfaceAlias Ethernet -ServerAddresses 192.168.0.254,192.168.0.253 -Validate
Warning: Test-DnsServer must be run from at least Windows Server 2008 R2 (no Windows client).
# Checks whether the indicated server is a DNS serverTest-DnsServer -IPAddress 10.0.0.3
# Test whether the DNS server is functional and configured as a redirectorTest-DnsServer -IPAddress 192.168.0.254 -Context Forwarder
# Test if DNS server is functional and configured with root serversTest-DnsServer -IPAddress 1.1.1.1 -Context RootHints
# Test if DNS server is functional and hosts a specific zoneTest-DnsServer -IPAddress 185.199.110.153 -ZoneName “altf4-formation.fr
Related links
Powershell - Testing network connectivity and port accessibility
Testing network connectivity and port accessibility with PowershellPowershell - Display network connections (equivalent to netstat)
Display network connections (listening ports, active connections...)Powershell - Testing name resolution (equivalent to nslookup)
Powershell commands to test name resolution (equivalent to nslookup)Powershell - View and manage DNS configuration of network interfaces
Powershell commands to display and manage DNS configuration of network interfacesPowershell - Managing IP configuration of network interfaces
Powershell commands to view and modify the IP configuration of network interfacesPowershell - Managing the status and configuration of network interfaces
Powershell commands to view and modify the status and configuration of network interfaces (disable IPv6, enable/disable an interface)
Follow me on
Support me
Last content
Powershell - Testing network connectivity and port accessibility
Powershell - Display network connections (equivalent to netstat)
Powershell - Testing name resolution (equivalent to nslookup)
Powershell - View and manage DNS configuration of network interfaces
Powershell - Managing IP configuration of network interfaces
Powershell - Managing the status and configuration of network interfaces
Powershell and the Left Hand Side
Powershell - Managing disks, partitions and volumes