parent
390f65bd6a
commit
9fdaa86c9f
1 changed files with 13 additions and 3 deletions
|
@ -135,7 +135,11 @@ Function Get-DnsClientMatch {
|
|||
|
||||
$current_dns_v4 = ($current_dns_all | Where-Object AddressFamily -eq 2 <# IPv4 #>).ServerAddresses
|
||||
|
||||
If ($current_dns_v4 -eq $null) {
|
||||
If (($current_dns_v4 -eq $null) -and ($ipv4_addresses -eq $null)) {
|
||||
$v4_match = $True
|
||||
}
|
||||
|
||||
ElseIf (($current_dns_v4 -eq $null) -or ($ipv4_addresses -eq $null)) {
|
||||
$v4_match = $False
|
||||
}
|
||||
|
||||
|
@ -167,8 +171,14 @@ Function Set-DnsClientAddresses
|
|||
|
||||
Write-DebugLog ("Setting DNS addresses for adapter {0} to ({1})" -f $adapter_name, ($ipv4_addresses -join ", "))
|
||||
|
||||
If ($ipv4_addresses -eq $null) {
|
||||
Set-DnsClientServerAddress -InterfaceAlias $adapter_name -ResetServerAddress
|
||||
}
|
||||
|
||||
Else {
|
||||
# this silently ignores invalid IPs, so we validate parseability ourselves up front...
|
||||
Set-DnsClientServerAddress -InterfaceAlias $adapter_name -ServerAddresses $ipv4_addresses
|
||||
}
|
||||
|
||||
# TODO: implement IPv6
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue