I using this script in order to automatically enabling DoH on all my network interfaces; but when I check the configuration on Settings app I see that the IP addresses are setted but they are setted as "Not encrypted", so I've to manually set them to "On (automatic template)". How can I do this via script?
$i = Get-NetAdapter -Physical
$i | Get-DnsClientServerAddress -AddressFamily IPv4 | Set-DnsClientServerAddress -ServerAddresses '176.103.130.130', '1.1.1.2'
$i | Get-DnsClientServerAddress -AddressFamily IPv6 | Set-DnsClientServerAddress -ServerAddresses '2a10:50c0::ad1:ff', '2606:4700:4700::1112'
$i | ForEach-Object {
$s1 = 'HKLM:System\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\' + $_.InterfaceGuid + '\DohInterfaceSettings\Doh\176.103.130.130'; New-Item -Path $s1 -Force | New-ItemProperty -Name "DohFlags" -Value 5 -PropertyType Qword
$s2 = 'HKLM:System\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\' + $_.InterfaceGuid + '\DohInterfaceSettings\Doh\1.1.1.2'; New-Item -Path $s2 -Force | New-ItemProperty -Name "DohFlags" -Value 5 -PropertyType Qword
$s3 = 'HKLM:System\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\' + $_.InterfaceGuid + '\DohInterfaceSettings\Doh6\2a10:50c0::ad1:ff'; New-Item -Path $s3 -Force | New-ItemProperty -Name "DohFlags" -Value 5 -PropertyType Qword
$s4 = 'HKLM:System\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\' + $_.InterfaceGuid + '\DohInterfaceSettings\Doh6\2606:4700:4700::1112'; New-Item -Path $s4 -Force | New-ItemProperty -Name "DohFlags" -Value 5 -PropertyType Qword
}
Clear-DnsClientCache;