I have a network wherein CNAME entries are created for some servers and not for others. How can I get the details for server names alone by executing Resolve-DnsName script?
If I try
$servername = Resolve-DnsName -Name webserver.999.com
Write-Host $servername.Name
I get 2 results one with webserver.999.com and another with the actual server name post resolving the DNS for servers with CNAME, but only the server name where CNAME entry is not present. I am looking for a solution wherein the command catches the result with only the server name.