Forum Discussion
Register only network adapter in DNS which is connected to company network
I came across this scenario recently. The way I found to make your suggestion work is using a script to disable the "register this connection's address in DNS" for all the NIC Adapters except when it has the "domain" property populated with the internal AD Domain (then it will register the connection).
This is what I used, you can test and see if it also works for you:
$search = "contoso.local"
$Reg = gci Registry::HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\interfaces
foreach ($rkey in $Reg.name)
{​​​​​​​
$rvalues = Get-ItemProperty Registry::$rkey
foreach ($value in $rvalues)
{​​​​​​​
if ($value.Domain -notmatch $search)
{​​​​​​​
if (Test-Path "$rvalues\RegistrationEnabled")
{​​​​​​​
Set-ItemProperty -path $value.PSPath -name RegistrationEnabled -value "0"
}​​​​​​​
else {​​​​​​​
New-ItemProperty -path $value.PSPath -name RegistrationEnabled -value "0" -PropertyType DWORD
}​​​​​​​
}​​​​​​​
}​​​​​​​
}​​​​​​​
Best Regards,
Helen