# This script must be run as Administrator function Run-Elevated ($scriptblock) { $sh = new-object -com 'Shell.Application' $sh.ShellExecute('powershell', "-NoExit -NonInteractive -Command $scriptblock", '', 'runas') } $configure_doh_script = { # List of Liberador DNS Servers $dnsServers = @('45.63.105.236', '51.91.192.251') foreach ($dns in $dnsServers){ try { # Check if DNS over HTTPS is already available for DNS Server Get-DnsClientDohServerAddress -ServerAddress $dns -ErrorAction Stop # Update DoH configuration Set-DnsClientDohServerAddress -ServerAddress $dns -DohTemplate 'https://dns.liberador.net/' -AllowFallbackToUdp $False -AutoUpgrade $True } catch { # Add DoH configuration Add-DnsClientDohServerAddress -ServerAddress $dns -DohTemplate 'https://dns.liberador.net/' -AllowFallbackToUdp $False -AutoUpgrade $True } } # Get the current Network adapter interface index $ifIndex = (Get-NetAdapter).InterfaceIndex # Set IPv4 DNS Servers on current Network adapter Set-DnsClientServerAddress -InterfaceIndex $ifIndex -ServerAddresses $dnsServers # Clear the DNS Cache Clear-DnsClientCache } Run-Elevated($configure_doh_script)