What DNS Server Am I Using PowerShell?

//

Heather Bennett

Are you curious to know what DNS server you are currently using in PowerShell? In this tutorial, we will explore how to find out the DNS server using PowerShell commands. Let’s dive in!

Checking the DNS Server Using PowerShell

If you want to determine the DNS server that your computer is currently using, you can utilize the Get-DnsClientServerAddress cmdlet in PowerShell.

To get started, open a PowerShell window by searching for “PowerShell” in the Windows Start menu and selecting the appropriate option.

Once the PowerShell window is open, type the following command:


Get-DnsClientServerAddress

This command will display a list of all DNS servers configured on your computer. The output will include both IPv4 and IPv6 addresses.

Example Output:


InterfaceAlias               Interface Address ServerAddresses
                             Index     Family
--------------               --------- ------- ---------------
Ethernet 2                   14        IPv4    {192.168.1.1}
Ethernet 2                   14        IPv6    {2001:0db8:85a3::1}

The InterfaceAlias column represents the network interface name, while the AddressFamily column indicates whether it is an IPv4 or IPv6 address.

Finding Your Active DNS Server:

If you want to filter out only your active DNS server address, you can modify the command as follows:


(Get-DnsClientServerAddress | Where-Object {$_.ServerAddresses -ne $null}).ServerAddresses

This command will display only the currently active DNS server address in the output.

Example Output:


192.1

Conclusion

In this tutorial, we learned how to determine the DNS server using PowerShell commands. By utilizing the Get-DnsClientServerAddress cmdlet, you can easily retrieve a list of DNS servers configured on your computer. Additionally, with a slight modification to the command, you can filter out and display only your active DNS server address.

Now that you know how to find out what DNS server you are using in PowerShell, you have gained valuable insights into your network configuration. This information can be useful for troubleshooting connectivity issues or simply satisfying your curiosity about your current DNS setup.

Keep exploring PowerShell commands and enhancing your knowledge of various networking aspects!

Discord Server - Web Server - Private Server - DNS Server - Object-Oriented Programming - Scripting - Data Types - Data Structures

Privacy Policy