DNS header

There is a DNSClient module on PowerShell you can use in addition ipconfig command. By default, this command is available on the PowerShell, if not, you can load the module manually using the command below:

Import-Module DnsClient

To see the available command on DnsClient module, you can use the Get-Command -Module DnsClient

Get-Command -Module DnsClient

As you can see in the image above, there are 17 commands in the DnsClient module you can use. Below some description for the DnsClient module commands.

Clear-DnsClientCache

This command allows you to clear all the content of the DNS Client cache. Clear-DnsClientCache is equivalent with ipconfig /flushdns command.

Get-DnsClient

You can use the Get-DnsClient command to get the specific configuration detail of the DNS client setting on different network interface on specific computer.

PS C:\WINDOWS\system32> Get-DnsClient
InterfaceAlias Interface ConnectionSpecificSuffix ConnectionSpecificSuffix RegisterThisConn UseSuffixWhen
Index SearchList ectionsAddress Registering
-------------- --------- ------------------------ ------------------------ ---------------- -------------
Ethernet 16 {} True False
Local Area Connection* 1 19 {} True False
Local Area Connection* 2 3 {} True False
Bluetooth Network Connection 15 {} True False
Wi-Fi 20 domain.name {} True False
Loopback Pseudo-Interface 1 1 {} True False

Get-DnsClientServerAddress

This command allows you to get the DNS Server address that has been assigned to the specific Network Interface.

PS C:\WINDOWS\system32> Get-DnsClientServerAddress -InterfaceAlias "Wi-Fi"
InterfaceAlias Interface Address ServerAddresses
Index Family
-------------- --------- ------- ---------------
Wi-Fi 20 IPv4 {8.8.8.8, 8.8.4.4}
Wi-Fi 20 IPv6 {}

If you want to change the DnsClient Server Address above, you can use the command Set-DnsClientServerAddress. Below is the example command to change the DNS Client Server Address.

PS C:\WINDOWS\system32> Get-DnsClientServerAddress -InterfaceAlias "Wi-Fi" | Set-DnsClientServerAddress -Addresses {1.1.1.1,8.8.8.8,8.8.4.4}
PS C:\WINDOWS\system32> Get-DnsClientServerAddress -InterfaceAlias "Wi-Fi"
InterfaceAlias Interface Address ServerAddresses
Index Family
-------------- --------- ------- ---------------
Wi-Fi 20 IPv4 {1.1.1.1, 8.8.8.8, 8.8.4.4}
Wi-Fi 20 IPv6 {}

Register-DnsClient

This is a very useful command if you don’t want to wait the DNS Registration after changing the IP Address. For example, you want to registers all of the IP addresses on the domain computer onto the configured DNS server. Register-DnsClient is equivalent to ipconfig /registerdns command.

If you like this article, please share, subscribe or you can follow our Facebook Page and Twitter.