2
I am trying to search a list of specific DNS servers (i have in a file) and then query for a specific host name. I can do this bit :)
The next bit is I wish to return a list of those DNS Servers which return a result which other than outlook-emea*, I want the IP of the DNS Server and also the result.
The problem i have is the DNS command returns CNAMES and A records - i am only interested in A records and also i am not sure how to filter the results. This is what I have so far.
$Address = 'outlook.office365.com'
#$listofIPs = Get-Content 'C:\Users\user1\file.txt'
$listofIPs = '8.8.8.8'
$ResultList = @()
foreach ($ip in $listofIPs)
{
$Result = Resolve-DnsName -Name $Address -Type A -Server $ip
Write-Host ""
Write-Host DNS Server: -foregroundcolor "green" $ip
Write-Host ""
Write-Host Resolved Names: -foregroundcolor "green"
}
Can someone help?
Does my answer suits your needs ? If so, please up vote it and mark it as accepted answer. If it doesn't, please explain how I can improve it. Thanks – Ob1lan – 2015-06-06T18:57:29.263
Thank you ever so much!!! I will now try understand the code to learn from it. many thanks . Im sorry my rep is too low to UpVote....but it is perfect! – Dave Davidson – 2015-06-08T09:42:51.577