Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jschlackman/f27af056f16215a6fefc8ffbf1a3fee5 to your computer and use it in GitHub Desktop.
Save jschlackman/f27af056f16215a6fefc8ffbf1a3fee5 to your computer and use it in GitHub Desktop.
Disable 'Automatically detect settings' in Internet Explorer's proxy settings dialog.
# Disable 'Automatically detect proxy settings' in Internet Explorer.
# 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
$conSet[4]++
Set-ItemProperty -Path $regKeyPath -Name DefaultConnectionSettings -Value $conSet
} Else {
Write-Host "'Automatically detect proxy settings' was already disabled."
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment