DNS troubleshooting in PowerShell
DNS means domain name server or system you can say that so
with the help of DNS in your system whenever you will browse anything like
google.com so it will resolver by dns first. It is used for translates
human-readable web addresses (like google.com) into computer-readable IP
addresses. Anyone around the world can use it as a free alternative to their
internet service provider's default DNS server.
The IP address
8.8.8.8 is a public Google Public DNS resolver operated by Google LLC.
DNS troubleshooting with PowerShell
1. Check which DNS server your computer is using
- Get-DnsClientServerAddress
This shows the DNS servers configured on each network adapter.
For example:
InterfaceAlias ServerAddresses
-------------- ---------------
Wi-Fi {192.168.1.1}
If you're on an AD lab, you would typically expect the client/member server to use the Domain Controller's IP as its DNS server.
2. Check DNS configuration for a specific adapter
- Get-DnsClientServerAddress -InterfaceAlias "Wi-Fi"
For Ethernet:
- Get-DnsClientServerAddress -InterfaceAlias "Ethernet"
3. Test whether DNS can resolve a hostname
This is one of the most useful commands for IT Support:
- Resolve-DnsName google.com
You should get information such as:
Name
Type IPAddress
----
---- ---------
google.com A
xxx.xxx.xxx.xxx
For your AD lab, test your domain:
- Resolve-DnsName test.com
or your Domain Controller:
- Resolve-DnsName dc01.test.com
4. Test DNS using a specific DNS server
This is very useful for troubleshooting.
- Resolve-DnsName google.com -Server 8.8.8.8
You're saying:
- "Ask DNS server 8.8.8.8 to resolve this name."
You can compare it with your configured DNS server:
- Resolve-DnsName google.com -Server 192.168.1.1
This helps determine whether the problem is with the DNS server or your
local configuration.
5. Check DNS cache
- Get-DnsClientCache
This displays DNS records currently cached by the Windows DNS client.
To clear the cache:
- Clear-DnsClientCache
This is useful when troubleshooting situations where an old DNS record
is being returned.
6. Check whether a DNS server is reachable
You can test connectivity:
- Test-NetConnection 8.8.8.8 -Port 53
For your AD DNS server:
Test-NetConnection 192.168.1.10
-Port 53
Look for:
- TcpTestSucceeded : True
Important: DNS normally uses UDP 53, while Test-NetConnection
-Port 53 tests TCP connectivity. So this is a connectivity check, not a
complete DNS functionality test.
7. Check the DNS client service
Windows has a DNS Client service.
- Get-Service -Name Dnscache
Example:
Status Name
DisplayName
------ ----
-----------
Running Dnscache DNS Client
If necessary:
Restart-Service -Name Dnscache
Be careful with
restarting services on production machines.
A real IT Support troubleshooting scenario
Suppose a user says:
"I can connect to Wi-Fi, but I
can't open websites."
Don't immediately assume it's an internet
problem.
You could troubleshoot:
Step 1 — Check IP configuration
- Get-NetIPConfiguration
Step 2 — Check configured DNS
- Get-DnsClientServerAddress
Step 3 — Test DNS resolution
- Resolve-DnsName google.com
Step 4 — Test another DNS server
- Resolve-DnsName google.com -Server 8.8.8.8
Step 5 — Check DNS cache
- Get-DnsClientCache
Step 6 — Clear DNS cache if appropriate
- Clear-DnsClientCache
Then test again:
Resolve-DnsName google.com
For
your Active Directory lab
This is particularly important for your
System Engineer preparation.
Your lab should look roughly like:
On the Windows 10 client:
- Get-DnsClientServerAddress
Check that the DNS server points to your Domain Controller's IP, not an
external DNS server such as 8.8.8.8.
Then:
- Resolve-DnsName yourdomain.local
And:
- Resolve-DnsName dc01.yourdomain.local
This is a much better lab exercise for your GitHub documentation
because it demonstrates the relationship between DNS + Active Directory +
Windows client troubleshooting, rather than simply showing individual
commands.
Commands:
- Get-DnsClientServerAddress
- Get-DnsClientCache
- Resolve-DnsName
- Test-NetConnection
- Get-NetIPConfiguration
- Get-Service -Name Dnscache
- Clear-DnsClientCache


















