Get DnsClientServerAddress - PowerShell


The Get-DnsClientServerAddress command retrieves the DNS client server address that is configured on the local computer. This command is useful for managing DNS client settings and troubleshooting network connectivity issues.


Get-DnsClientServerAddress [[-InterfaceIndex] <Int32>]




Example 1: Get the DNS client server address for all network interfaces


Example 2: Get the DNS client server address for a specific network interface

Get-DnsClientServerAddress -InterfaceIndex 1

Common Issues

Error: “The operation requested is not supported”

This error can occur if the network interface specified in the -InterfaceIndex parameter is not a valid or active interface. Ensure that the interface index is correct and that the interface is enabled.


The Get-DnsClientServerAddress command can be used with other PowerShell commands to manage DNS client settings. For example, the following script sets the DNS client server address for the first network interface:

$InterfaceIndex = 1
$DnsServerAddress = ""
Set-DnsClientServerAddress -InterfaceIndex $InterfaceIndex -ServerAddresses $DnsServerAddress