Powershell

Resolve-DnsName: Resolving DNS Records with PowerShell

The cmdlet “Resolve-DnsName” allows the users to perform a DNS query for the specified name. Primarily, it resolves the DNS address command. This can resolve several types of records including TXT, CNAME, PTR, SRV, A, and MX. This cmdlet’s functionality is quite similar to the “nslookup” tool that helps the users to query for names.

This blog will observe several examples to explain the usage of the “Resolve-DnsName” cmdlet.

Resolve-DnsName: Resolving DNS Records with PowerShell

As stated earlier, the “Resolve-DnsName” cmdlet performs the DNS name query resolution for the specified name. The examples explaining the stated cmdlet are given below.

Example 1: Resolve DNS Using Default Options

This cmdlet will help resolve the DNS address using the default options provided:

Resolve-DnsName -Name www.Google.com

 
In the above-mentioned command:

    • First, write the “Resolve-DnsName” cmdlet.
    • After that, add the “-Name” parameter and assign the “www.Google.com” DNS address:

 

Example 2: Resolve DNS With “A” Type

This illustration will resolve the provided DNS having the property type “A”. To do so, simply write the “-Type” parameter and specify the type as “A”:

Resolve-DnsName -Name www.Google.com -Type A

 

Example 3: Resolve DNS With “-DnsOnly” Option

In this demonstration, only the provided DNS will be resolved. For that reason, specify the parameter “-DnsOnly”:

Resolve-DnsName -Name www.Google.com -DnsOnly

 

That’s how you can resolve DNS records with PowerShell.

Conclusion

The DNS records in PowerShell can be resolved using the “Resolve-DnsName” cmdlet. Moreover, additional parameters are used to resolve the DNS names with selective properties and types. This blog has observed complete details about resolving the DNS records in PowerShell.

About the author

Muhammad Farhan

I am a Computer Science graduate and now a technical writer who loves to provide the easiest solutions to the most difficult problems related to Windows, Linux, and Web designing. My love for Computer Science emerges every day because of its ease in our everyday life.