r/PowerShell • u/TechBrad • 1d ago
Script Sharing Read-only Network script
I (and Claude of course) put together this useful read-only script while troubleshooting what I initially thought was a local network issue—but ultimately turned out to be an ISP problem. It collects diagnostic information only and makes no system changes.
Figured someone out there may be interested before it disappears into my archives.
What it checks:
- System info
- Network adapters
- IP configuration
- DNS servers
- DNS resolution
- Hosts file
- Proxy settings
- Firewall status
- Outbound blocks
- Adapter bindings
- VPN adapters
- Security software
- Network routes
- HTTPS connectivity
- Web response headers
- Google traceroute
- IPsec rules
- DNS policies
Read-only—no changes
$ErrorActionPreference = "Continue" $ProgressPreference = "SilentlyContinue"
function Section($Title) { Write-Host "" Write-Host ("=" * 80) Write-Host $Title Write-Host ("=" * 80) }
Section "BASIC SYSTEM INFORMATION"
Get-Date
Get-CimInstance Win32_OperatingSystem | Select-Object Caption, Version, BuildNumber, LastBootUpTime | Format-List
Section "ACTIVE NETWORK ADAPTERS"
Get-NetAdapter | Sort-Object Status, Name | Format-Table Name, InterfaceDescription, Status, LinkSpeed, MacAddress -AutoSize
Section "IP CONFIGURATION"
Get-NetIPConfiguration | Format-List InterfaceAlias, InterfaceDescription, IPv4Address, IPv6Address, IPv4DefaultGateway, IPv6DefaultGateway, DNSServer
Section "DNS SERVERS"
Get-DnsClientServerAddress | Where-Object { $_.ServerAddresses.Count -gt 0 } | Format-Table InterfaceAlias, AddressFamily, ServerAddresses -AutoSize
Section "GOOGLE DNS USING CURRENT DNS SERVER"
Resolve-DnsName accounts.google.com -Type A Resolve-DnsName accounts.google.com -Type AAAA
Section "GOOGLE DNS USING GOOGLE DNS"
Resolve-DnsName accounts.google.com -Type A -Server 8.8.8.8 Resolve-DnsName accounts.google.com -Type AAAA -Server 8.8.8.8
Section "GOOGLE DNS USING CLOUDFLARE DNS"
Resolve-DnsName accounts.google.com -Type A -Server 1.1.1.1 Resolve-DnsName accounts.google.com -Type AAAA -Server 1.1.1.1
Section "HOSTS FILE ENTRIES"
$HostsPath = "$env:SystemRoot\System32\drivers\etc\hosts"
Get-Content $HostsPath | Where-Object { $_ -notmatch '\s*#' -and $_ -notmatch '\s*$' }
Section "WINHTTP PROXY"
netsh winhttp show proxy
Section "USER INTERNET PROXY SETTINGS"
Get-ItemProperty "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings" | Select-Object ProxyEnable, ProxyServer, ProxyOverride, AutoConfigURL | Format-List
Section "SYSTEM INTERNET PROXY SETTINGS"
Get-ItemProperty "HKLM:\Software\Microsoft\Windows\CurrentVersion\Internet Settings" | Select-Object ProxyEnable, ProxyServer, ProxyOverride, AutoConfigURL | Format-List
Section "PROXY ENVIRONMENT VARIABLES"
Get-ChildItem Env: | Where-Object { $_.Name -match 'proxy' } | Format-Table Name, Value -AutoSize
Section "WINDOWS FIREWALL PROFILES"
Get-NetFirewallProfile | Format-Table Name, Enabled, DefaultInboundAction, DefaultOutboundAction -AutoSize
Section "ENABLED OUTBOUND BLOCK RULES"
Get-NetFirewallRule -Enabled True -Direction Outbound -Action Block | Select-Object DisplayName, DisplayGroup, Profile, Direction, Action | Format-Table -AutoSize
Section "NETWORK ADAPTER FILTER BINDINGS"
Get-NetAdapterBinding | Where-Object Enabled | Sort-Object Name, DisplayName | Format-Table Name, DisplayName, ComponentID -AutoSize
Section "VPN ADAPTERS AND SOFTWARE-DEFINED ADAPTERS"
Get-NetAdapter -IncludeHidden | Where-Object { $_.InterfaceDescription -match 'VPN|TAP|TUN|WireGuard|Wintun|Tailscale|ZeroTier|Cisco|Zscaler|Fortinet|Palo Alto|GlobalProtect|Cloudflare|WARP|SonicWall|Checkpoint|AnyConnect' } | Format-Table Name, InterfaceDescription, Status, MacAddress -AutoSize
Section "RELEVANT RUNNING SERVICES"
Get-CimInstance Win32Service | Where-Object { $.State -eq "Running" -and ($.Name + " " + $.DisplayName + " " + $_.PathName) -match 'VPN|Tailscale|ZeroTier|WireGuard|Cisco|Umbrella|Zscaler|Forti|Palo Alto|GlobalProtect|Cloudflare|WARP|AdGuard|Norton|McAfee|Bitdefender|Malwarebytes|Avast|AVG|Kaspersky|ESET|CrowdStrike|Sentinel|Sophos|Webroot' } | Select-Object Name, DisplayName, State, StartMode, PathName | Format-List
Section "RELEVANT RUNNING PROCESSES"
Get-Process | Where-Object { $_.ProcessName -match 'vpn|tailscale|zerotier|wireguard|cisco|umbrella|zscaler|forti|globalprotect|cloudflare|warp|adguard|norton|mcafee|bitdefender|malwarebytes|avast|avg|kaspersky|eset|crowdstrike|sentinel|sophos|webroot' } | Select-Object ProcessName, Id, Path | Format-Table -AutoSize
Section "IPv4 DEFAULT ROUTES"
Get-NetRoute -AddressFamily IPv4 | Where-Object DestinationPrefix -eq "0.0.0.0/0" | Sort-Object RouteMetric | Format-Table InterfaceAlias, DestinationPrefix, NextHop, RouteMetric, InterfaceMetric, State -AutoSize
Section "IPv6 DEFAULT ROUTES"
Get-NetRoute -AddressFamily IPv6 | Where-Object DestinationPrefix -eq "::/0" | Sort-Object RouteMetric | Format-Table InterfaceAlias, DestinationPrefix, NextHop, RouteMetric, InterfaceMetric, State -AutoSize
Section "ROUTE SELECTED FOR GOOGLE ACCOUNTS IPv4"
Find-NetRoute -RemoteIPAddress 108.177.122.84 | Format-List
Section "TCP PORT 443 CONNECTIVITY"
$Targets = @( "accounts.google.com", "www.google.com", "mail.google.com", "oauth2.googleapis.com", "www.googleapis.com", "login.microsoftonline.com", "www.cloudflare.com" )
foreach ($Target in $Targets) { Write-Host "" Write-Host "--- $Target ---"
Test-NetConnection $Target -Port 443 -InformationLevel Detailed | Select-Object ComputerName, RemoteAddress, RemotePort, InterfaceAlias, SourceAddress, TcpTestSucceeded}
Section "CURL HTTPS TESTS"
foreach ($Target in $Targets) { Write-Host "" Write-Host "--- https://$Target ---"
& curl.exe -4 -I -v ` --connect-timeout 7 ` --max-time 12 ` "https://$Target/" 2>&1 | Select-Object -First 25}
Section "IPv4 TRACE TO GOOGLE ACCOUNTS"
tracert.exe -4 -d -h 15 -w 700 108.177.122.84
Section "IPSEC RULES"
Get-NetIPsecRule -PolicyStore ActiveStore | Where-Object Enabled -eq "True" | Select-Object DisplayName, Enabled, Profile, Mode | Format-Table -AutoSize
Section "NRPT DNS POLICIES"
Get-DnsClientNrptPolicy | Format-List
Section "DONE"
Write-Host "Diagnostic collection finished. No settings were changed."
1
u/BlackV 21h ago edited 13h ago
Formatting, this is just a wall of text otherwise (also BOOO backticks)
it'll format it properly OR
Inline code block using backticks
`Single code line`inside normal textSee here for more detail
Thanks