Open Xento opened 3 years ago
In line 931 of the released code, where it says:
$dnsAddressList = Resolve-DnsName -Name $fqdn -Server ($dnsServers | Select-Object -First 1) -Type A -DnsOnly | Select-Object -ExpandProperty IPAddress
I changed it to be the following with the change in bold and that resolved similar issues we were having.
$dnsAddressList = Resolve-DnsName -Name $fqdn -Server ($dnsServers | Select-Object -First 1) -Type A -DnsOnly | Where-Object {$_.Name -eq $fqdn} | Select-Object -ExpandProperty IPAddress
Had planned to submit this, but it fell through the cracks. If you make this change, does it address your issue?
Seems to fix the issue. My DNS Check is now OK with this change. Maybe this pullrequest is than obsolete https://github.com/AndersRodland/ConfigMgrClientHealth/pull/57
If I use your change, it doesn't fix the problem we are experiencing with the DNS test, whereas using $FQDN addresses both your problem and mine.
Our issue is that some (but not all) of the DNS servers we use have been configured to provide extra info, and due to organizational structure, we can't change that.
I'll go comment on the pull request.
Resolve-DnsName
needs -ErrorAction Stop
to be properly caught in the event that DNS is unable to resolve anything.
There are some issues with the dns check. It wont hurt when it detects a false positive but it distorts the reports.
$localIPs:
Resolve-DnsName -Name $fqdn -Server ($dnsServers | Select-Object -First 1) -Type A -DnsOnly | Where-Object -FilterScript {$_.IPAddress}
May be it would be best to only check the connection with the corrent dns suffix or make it configureable