# Check for Administrator privileges
if (-not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {
Write-Warning "You must run this script as Administrator."
pause
exit
}
Write-Host "Starting network reset and certificate cleanup..."
# Network reset commands
netsh winsock reset
netsh int ip reset
netsh advfirewall reset
ipconfig /flushdns
ipconfig /release
ipconfig /renew
# Suspicious certificate keywords
$keywords = @("localhost", "localdomain", "Tunnel", "Proton", "MyCompany", "Intercept")
# Certificate removal function
function Remove-Certs {
param (
[string]$storePath
)
foreach ($keyword in $keywords) {
Get-ChildItem -Path $storePath | Where-Object {
$_.Subject -like "*$keyword*" -or $_.Issuer -like "*$keyword*"
} | ForEach-Object {
Write-Host "Removing certificate: $($_.Subject)"
Remove-Item -Path "$storePath\$($_.Thumbprint)" -Force
}
}
}
Write-Host "Cleaning up certificates..."
Remove-Certs -storePath "Cert:\LocalMachine\Root"
Remove-Certs -storePath "Cert:\LocalMachine\CA"
Remove-Certs -storePath "Cert:\CurrentUser\Root"
Remove-Certs -storePath "Cert:\CurrentUser\CA"
# Remove proxy settings from registry
Write-Host "Resetting registry-based proxy settings..."
Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings" -Name ProxyEnable -ErrorAction SilentlyContinue
Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings" -Name ProxyServer -ErrorAction SilentlyContinue
# Clear browser cache folders
Write-Host "Clearing Chrome and Edge network cache..."
$chromePath = "$env:LOCALAPPDATA\Google\Chrome\User Data\Default\Cache"
$edgePath = "$env:LOCALAPPDATA\Microsoft\Edge\User Data\Default\Cache"
if (Test-Path $chromePath) { Remove-Item "$chromePath\*" -Force -Recurse -ErrorAction SilentlyContinue }
if (Test-Path $edgePath) { Remove-Item "$edgePath\*" -Force -Recurse -ErrorAction SilentlyContinue }
Write-Host "Network and certificate reset complete. Please restart your computer."
pause