News
New 1-Click Apps are now available in the Serverspace control panel
AS
May 19 2026
Updated May 19 2026

Windows DNS Commands Cheat Sheet

Windows

Windows DNS by Microsoft has quickly become a fundamental tool for network service automation and resource management. Thanks to its robust CLI integration and the power of PowerShell, it is ideal for creating stable network workflows where the system handles name resolution, cache management, and connectivity diagnostics.

Such workflows are essential for cloud infrastructure, DevOps pipelines, and server administration. Instead of manual configuration, administrators can use commands to automate record verification, flush outdated data, and ensure seamless interaction between services.

In this guide, we will examine how to manage Windows DNS using the command line, what tools are required for automation, and how to build your own network diagnostic scenarios.

What is a DNS Workflow

A DNS Workflow is a sequence of automatic actions where the operating system or a script performs network tasks on behalf of a human.

A simple example looks like this:

  • a service attempts to connect to a domain;
  • the Windows DNS Client checks the local cache;
  • if the record is missing or expired, it queries a DNS server;
  • the system validates the response (e.g., checks the IP or MX record);
  • if necessary, the script notifies the administrator of a resolution failure.

Why Use Windows CLI for DNS Management

Windows provides powerful built-in utilities that are perfect for infrastructure automation and deep diagnostics.

Main advantages:

Feature Benefit for Workflow
Local Cache Control Instant clearing of stale records via
ipconfig
Advanced Diagnostics Direct querying of specific record types (MX, TXT, AAAA)
PowerShell Integration Ability to pipe DNS results into other automation scripts
Zero Cost Built-in tools that do not require third-party licenses

Terminology

Before diving into the commands, we should briefly explain the key terms:

  • DNS Cache — a temporary database in the OS memory that stores recently resolved domain names.
  • TTL (Time to Live) — a setting that tells the resolver how long to cache a record.
  • Recursive Query — a request where the DNS server does all the work to find the final IP.
  • PTR Record — used for reverse lookups (finding a domain name by its IP address).

How DNS Resolution Works in Windows

The resolution process follows a predictable hierarchy:

  1. Checking the local
    hosts

    file.

  2. Searching the local DNS Client cache.
  3. Querying the primary and secondary DNS servers configured on the adapter.
  4. Returning the result to the application or service.

A typical chain:

Application → hosts → Local Cache → Cloud DNS → Final Result

Practical Instructions: DNS Command Cheat Sheet

1. Managing Cache with ipconfig

We use

ipconfig

for fast, everyday maintenance of the local resolver.

Flushing the DNS Cache
We recommend running this command whenever you change a domain's IP address:

ipconfig /flushdns

Viewing the Current Cache
Use this to see exactly what records the OS is holding in its memory:

ipconfig /displaydns

2. Deep Diagnostics with nslookup

The

nslookup

utility allows us to bypass the local cache and query servers directly.

Verifying an A-Record

nslookup serverspace.io

Checking Mail Servers (MX Records)

nslookup -type=mx google.com

Querying via a Specific Server
To see how the Cloudflare DNS (1.1.1.1) perceives your domain:

nslookup mydomain.com 1.1.1.1

3. Modern Automation: PowerShell DnsClient

For complex scripts, we advise using PowerShell cmdlets for more structured output.

Resolving a Name

Resolve-DnsName -Name serverspace.io

Viewing Configured DNS Servers

Get-DnsClientServerAddress

Common DNS Troubleshooting

Issue Cause Solution
Request Timed Out Network blockage or server is down Check firewall rules and ping the DNS IP
NXDOMAIN Error Domain does not exist or typo in FQDN Verify domain registration and spelling
Old Data Appearing Stale cache or long TTL Execute
ipconfig /flushdns

FAQ

Is it possible to use these commands on Windows Home?
Yes. These tools are included in all Windows editions, including Home, Pro, and Server.
Why is my browser not showing updated records?
Modern browsers often have their own internal DNS cache. You may need to clear your browser history or restart it.
How do I find a PTR record?
Simply type
nslookup [IP_Address]

to perform a reverse lookup.

Does ServerSpace provide its own DNS?
Yes. When using ServerSpace VPS, your servers are typically pre-configured to use high-performance local resolvers.

Conclusion

We have covered the essential Windows DNS commands that form the backbone of network diagnostics and automation. By integrating these tools into your daily workflow, you can ensure the high availability of your services and quickly resolve any connectivity issues.

In the ServerSpace cloud environment, mastering these commands allows you to build reliable infrastructures and maintain seamless communication between your virtual servers and the global web. Always remember to verify your results after flushing the cache to ensure you are seeing the most recent network data.

Vote:
5 out of 5
Аverage rating : 5
Rated by: 1
33401 West Palm Beach, FL 700 S Rosemary Ave, Suite 204
+1 302 425-97-76
700 300
ITGLOBAL.COM CORP | All rights reserved
700 300

You might also like...

We use cookies to make your experience on the Serverspace better. By continuing to browse our website, you agree to our
Use of Cookies and Privacy Policy.