Created
November 23, 2011 01:04
-
-
Save ReubenBond/1387620 to your computer and use it in GitHub Desktop.
Disable 'Automatically detect settings' in Internet Explorer's proxy settings dialog.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 | |
$conSet[4]++ | |
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