@echo on
setlocal
net session >nul 2>&1
if %errorlevel% neq 0 (
  echo [ERROR] Must run as Administrator.
  pause & exit /b 1
)

echo ================================================
echo   Reset system DNS to DHCP (automatic) on every
echo   UP physical adapter (uses PowerShell)
echo ================================================
echo.

powershell -NoProfile -ExecutionPolicy Bypass -Command "$adapters = Get-NetAdapter -Physical | Where-Object { $_.Status -eq 'Up' }; foreach ($a in $adapters) { Write-Host ('Resetting DNS on: ' + $a.Name); Set-DnsClientServerAddress -InterfaceIndex $a.ifIndex -ResetServerAddresses -ErrorAction Continue }"

echo.
echo Flushing DNS cache...
ipconfig /flushdns
echo.

echo Current DNS:
netsh interface ipv4 show dnsservers
pause
