echo "Getting DNS nameservers" $ns = Get-DnsClientServerAddress -AddressFamily IPv4 | Select-Object -ExpandProperty ServerAddresses | %{ "nameserver " + $_;} echo "Getting search domains" $sd = Get-DnsClientGlobalSetting | Select-Object -ExpandProperty SuffixSearchList | %{ "search " + $_;} echo "-----------------------" echo $ns echo $sd echo "-----------------------" Read-Host -Prompt 'Hit enter after you copy the above text in wsl /etc/resolv.conf' echo "Changing InterfaceMetric for Cisco Anyconnect" Get-NetAdapter | Where-Object {$_.InterfaceDescription -Match "Cisco AnyConnect"} | Set-NetIPInterface -InterfaceMetric 6000 # get wsl process $wsl = Get-Process wsl -ErrorAction SilentlyContinue $continue = "n" if ($wsl) { echo "wsl is running. You may want to save any incomplete work before proceeding" while($continue -eq 'n') { $continue = Read-Host -Prompt 'Should I restart wsl' } } remove-variable wsl echo "Restarting wsl" Restart-Service LxssManager