PowerShell alternative to Dig

In the Linux environment, I have always found the shell dig command really useful as a way of getting a little more domain info than is returned by using a simple ping.

If you happen to be using Windows, Resolve-DnsName is the PowerShell alternative and I’ve added both here for personal reference more than anything else.

Resolve all records

Shell

dig google.com any

PowerShell

Resolve-DnsName -Name google.com -Type any

Resolve A records

Shell

dig google.com a

PowerShell

Resolve-DnsName -Name google.com -Type a

Resolve MX records

Shell

dig google.com mx

PowerShell

Resolve-DnsName -Name google.com -Type mx