Skip to content

Instantly share code, notes, and snippets.

@carlthewebmaster
Created April 5, 2016 16:34
Show Gist options
  • Save carlthewebmaster/5e29911aee6c7e83138db40f9bc4ae67 to your computer and use it in GitHub Desktop.
Save carlthewebmaster/5e29911aee6c7e83138db40f9bc4ae67 to your computer and use it in GitHub Desktop.
$Path="HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings"
$proxyServer = Get-ItemProperty -path $Path ProxyServer -ErrorAction SilentlyContinue
if([string]::IsNullOrEmpty($proxyServer)){
Set-ItemProperty -path $Path ProxyEnable -value 1
Set-ItemProperty -path $Path ProxyServer -Value "localhost:3128"
Write-Host "Proxy is enabled"
}
else {
Set-ItemProperty -path $Path ProxyEnable -value 0
Remove-ItemProperty -path $Path -name ProxyServer
Write-Host "Proxy is disabled"
}
Write-Host "Script Check passed"
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment