Instantly share code, notes, and snippets.

Embed
What would you like to do?
PowerShell Set-Proxy, Clear-proxy
# NOTE: registry keys for IE 8, may vary for other versions
$regPath = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings'
function Clear-Proxy
{
Set-ItemProperty -Path $regPath -Name ProxyEnable -Value 0
Set-ItemProperty -Path $regPath -Name ProxyServer -Value ''
Set-ItemProperty -Path $regPath -Name ProxyOverride -Value ''
[Environment]::SetEnvironmentVariable('http_proxy', $null, 'User')
[Environment]::SetEnvironmentVariable('https_proxy', $null, 'User')
}
function Set-Proxy
{
$proxy = 'http://example.com'
Set-ItemProperty -Path $regPath -Name ProxyEnable -Value 1
Set-ItemProperty -Path $regPath -Name ProxyServer -Value $proxy
Set-ItemProperty -Path $regPath -Name ProxyOverride -Value '<local>'
[Environment]::SetEnvironmentVariable('http_proxy', $proxy, 'User')
[Environment]::SetEnvironmentVariable('https_proxy', $proxy, 'User')
}
@PI-Victor

This comment has been minimized.

PI-Victor commented Nov 24, 2014

starred. because it deserves to be! 💧

@famousgarkin

This comment has been minimized.

Owner

famousgarkin commented Nov 26, 2014

😆

@martinko2009

This comment has been minimized.

martinko2009 commented Aug 28, 2018

how to set the username and password of proxy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment