Write-Host "=== NETWORK DIAGNOSTICS ===" -ForegroundColor Cyan function Test-Step($name, $script) { Write-Host "`n$name..." -ForegroundColor Yellow try { & $script } catch { Write-Host "Error: $_" -ForegroundColor Red } } # 1. Network Adapter Status Test-Step "Network Adapter Status" { Get-NetAdapter | Where-Object {$_.Status -ne "Disabled"} | Format-Table Name, Status, LinkSpeed } # 2. IP and DHCP Test-Step "IP Configuration" { ipconfig } # 3. DHCP Renewal Test-Step "Renewing DHCP" { ipconfig /release ipconfig /renew } # 4. Flush DNS Cache Test-Step "Flushing DNS" { ipconfig /flushdns } # 5. Default Gateway Test $gateway = (ipconfig | Select-String "Default Gateway").ToString().Split(":")[-1].Trim() if ($gateway) { Test-Step "Ping to Gateway ($gateway)" { Test-Connection $gateway -Count 2 } } # 6. Internet Connectivity by IP (Cloudflare) Test-Step "Ping to Internet (1.1.1.1)" { Test-Connection 1.1.1.1 -Count 2 } # 7. DNS Test Test-Step "DNS Test (google.com)" { nslookup google.com } # 8. HTTP Test Test-Step "HTTP Connection Test" { try { $r = Invoke-WebRequest "http://www.msftconnecttest.com/connecttest.txt" -UseBasicParsing -TimeoutSec 10 Write-Host "HTTP OK" -ForegroundColor Green } catch { Write-Host "No HTTP access" -ForegroundColor Red } } Write-Host "`n=== ATTEMPTING TEMPORARY DNS/PROXY FIX ===" -ForegroundColor Cyan $env:HTTPS_PROXY = $null $env:HTTP_PROXY = $null [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12 Write-Host "Session proxy settings cleared." Write-Host "`n=== DONE ===" -ForegroundColor Green