DNS commands for Windows you should know

At some point, most people with a computer have likely interacted with a command line interface. If you haven’t, here are the basics. With a program called a shell, you can execute tasks by entering a specific line of text known as a command. 

It’s an old-school way of using a computer. However, some users prefer to use commands for specific tasks as it can actually speed up certain processes, allowing them to interact directly with the system rather than clicking around their computer’s graphical user interface. 

In this article, we’ll go through key Windows commands related to the Domain Name System (DNS). So, if you’ve ever wondered how to perform a Windows DNS lookup, this article is for you.

How to use commands on Windows

You have two options if you have a Windows machine and want to perform tasks using a command line interface: Windows Command Prompt (CMD) and Windows PowerShell. 

CMD

CMD is the classic command line interface for Windows and has been available on Windows operating systems since 1981. Back then, this was the only way to interact with a computer, so be thankful for your modern-day icons, menus, and mouse cursors. CMD lets users run one command at a time. The window has a black background with white text. Depending on the machine, the command prompt will look like:

C:\> or C:\Users\name>

On Windows 10 or 11, you can easily find CMD by searching for “CMD” or “Command Prompt” in the search taskbar. You could also use the keyboard shortcut Win + R and search for it in the Run command window.

Windows PowerShell

Windows PowerShell has been around since 2006 and has more advanced capabilities than CMD. It uses Command lets (cmdlets) rather than commands, which are slightly more flexible and allow users to initiate multiple tasks simultaneously. The PowerShell looks similar to CMD but features a blue background rather than black. You can also find it similarly by searching for the program in the taskbar or Run window. Alternatively, the keyboard shortcut Win + X will lead you to a menu with the program.

Now that you know the basics of commands, let’s explore some important DNS commands on Windows.

Key DNS commands you should know

Here are a few essential DNS commands and how to run them on CMD and PowerShell.

Nslookup

Nslookup is short for Nameserver lookup. If you’re having issues with DNS name resolution, this command can provide information such as the IP address of a host and more.

CMD

Enter the command: C:\Users\username>nslookup website (e.g. C:\Users\username>nslookup ssls.com)

PowerShell

Nslookup is known as Resolve-DnsName in PowerShell:

PS C:\Users\username>Resolve-DnsName website (e.g. PS C:\Users\username>Resolve-DnsName ssls.com)

DNS Record Lookup

You can use the DNS lookup command to check the DNS records for your domain. 

CMD

You’ll need to specify the type of record you want to verify in the DNS lookup cmd, for example, mail exchange (MX) or start of authority (SOA) record. To look up SOA records with CMD, enter the following:

C:\Users\username>nslookup

>set q=soa

> website

Powershell

Looking up DNS records in PowerShell requires the Resolve-DnsName cmdlet once more. Like with CMD, you must specify the record type by adding “-type record” at the end of the cmdlet. As an example:

PS C:\Users\username>Resolve-DnsName ssls.com -Type MX

Reverse DNS Lookup

With this command, you can find the name of a domain if you have the IP address.

CMD

Enter: C:\Users\username>nslookup AP address

Powershell

Enter: PS C:\Users\username>Resolve-DnsName IP address

Ping Command

This command will help with performing network diagnostics and latency. 

CMD

For this command, you’ll need the DNS address of the domain you want to test:

C:\Users\username>Ping DNS address

Powershell

With PowerShell, you just need the website name:

PS C:\Users\username>Test-Connection ssls.com

Traceroute Command

This command is also beneficial for network and connectivity troubleshooting. It traces a packet’s path from start to finish, showing all the hops it made along the way. 

CMD

You can use either the website name or IP address for the command:

C:\Users\username>tracert IP address

C:\Users\username>tracert website

Powershell

Enter:

PS C:\Users\username>tracert website

Share on Twitter, Facebook, Google+