Winhance icon indicating copy to clipboard operation
Winhance copied to clipboard

[FEATURE] Additional option to use encrypted DNS when setting DNS Server

Open oemskin opened this issue 7 months ago • 0 comments

Please confirm these before moving forward

  • [x] I have searched for similar feature requests and have not found a duplicate.

Feature Type

New functionality

Describe your feature request

Winhance already allows for basic DNS server setup and it would be nice if it would also have:

  1. An additional option when setting DNS Server to set it to use encryption / DoH
  2. An additional option to set the IPv6 DNS Server

Use case

I end up setting these in every windows install and, since winhance is already setting the basic DNS, it would be nice to have the option to include DoH and IPv6 in winhance.

Software Details (Only for 'New software to be added' requests)

I used to setup windows DNS manually on every install and now I am using the following script after winhance runs:

Define Cloudflare DNS addresses and the DoH Template

$IPv4_DNS = @("1.1.1.1", "1.0.0.1") $IPv6_DNS = @("2606:4700:4700::1111", "2606:4700:4700::1001") $DoH_Template = "https://cloudflare-dns.com/dns-query"

Register Cloudflare as a known DoH provider in Windows

Write-Host "Registering Cloudflare DoH templates..." -ForegroundColor Cyan foreach ($IP in ($IPv4_DNS + $IPv6_DNS)) { Add-DnsClientDohServerAddress -ServerAddress $IP -DohTemplate $DoH_Template -AutoUpgrade $true -ErrorAction SilentlyContinue }

Apply to all active physical adapters

$Adapters = Get-NetAdapter | Where-Object { $_.Status -eq "Up" }

foreach ($Adapter in $Adapters) { Write-Host "Configuring adapter: $($Adapter.Name)..." -ForegroundColor Yellow

# Set IPv4 and IPv6 DNS Addresses
Set-DnsClientServerAddress -InterfaceAlias $Adapter.InterfaceAlias -ServerAddresses ($IPv4_DNS + $IPv6_DNS)

#  Force Encryption (DoH) via Registry
# This step is often required to ensure Windows UI shows "Encrypted (only)"
$InterfaceGuid = $Adapter.InterfaceGuid

# Configure IPv4 DoH Registry Keys
foreach ($IP in $IPv4_DNS) {
    $RegPath = "HKLM:\System\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\$IP"
    if (!(Test-Path $RegPath)) { New-Item -Path $RegPath -Force | Out-Null }
    New-ItemProperty -Path $RegPath -Name "DohFlags" -Value 1 -PropertyType QWORD -Force | Out-Null
}

# Configure IPv6 DoH Registry Keys
foreach ($IP in $IPv6_DNS) {
    $RegPath = "HKLM:\System\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh6\$IP"
    if (!(Test-Path $RegPath)) { New-Item -Path $RegPath -Force | Out-Null }
    New-ItemProperty -Path $RegPath -Name "DohFlags" -Value 1 -PropertyType QWORD -Force | Out-Null
}

}

Flush DNS to apply changes

Clear-DnsClientCache Write-Host "Cloudflare Encrypted DNS (DoH) is now active for all physical adapters." -ForegroundColor Green

Additional context

No response

oemskin avatar Apr 20 '26 13:04 oemskin