Enabling internet proxy using powershell


If you are feeling lazy and not intersted in setting up Internet proxy on your server from UI then use the script below to enable and disable.  Nothing special but works.

To Enable the proxy

$ProxyServer = "proxy.com" $ProxyPort = "8080" $Path = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings" $Proxy = $ProxyServer + ":" + $ProxyPort # Enable an explicit proxy Set-ItemProperty -Path $path -Name ProxyEnable -Value 1 #Enable the explicit proxy Set-ItemProperty -Path $path -Name ProxyServer -Value $Proxy #Configure the server settings

To Disable the Proxy

# Disable an explicit proxy
Set-ItemProperty -Path $path -Name ProxyEnable -Value 0 #Disable the explicit proxy