Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Disable 'Automatically detect settings' in Internet Explorer's proxy settings dialog.
# Disable 'Automatically detect proxy settings' in Internet Explorer.
function Disable-AutomaticallyDetectProxySettings
# Read connection settings from Internet Explorer.
$regKeyPath = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\Connections\"
$conSet = $(Get-ItemProperty $regKeyPath).DefaultConnectionSettings
# Index into DefaultConnectionSettings where the relevant flag resides.
$flagIndex = 8
# Bit inside the relevant flag which indicates whether or not to enable automatically detect proxy settings.
$autoProxyFlag = 8
if ($($conSet[$flagIndex] -band $autoProxyFlag) -eq $autoProxyFlag)
# 'Automatically detect proxy settings' was enabled, adding one disables it.
Write-Host "Disabling 'Automatically detect proxy settings'."
$mask = -bnot $autoProxyFlag
$conSet[$flagIndex] = $conSet[$flagIndex] -band $mask
Set-ItemProperty -Path $regKeyPath -Name DefaultConnectionSettings -Value $conSet
$conSet = $(Get-ItemProperty $regKeyPath).DefaultConnectionSettings
if ($($conSet[$flagIndex] -band $autoProxyFlag) -ne $autoProxyFlag)
Write-Host "'Automatically detect proxy settings' is disabled."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.