0

I have written a script to toggle proxy server's automatically detect settings feature. Script is running fine except it is unnecessarily checking "use a proxy server for your lan" feature as well.

enter image description here

here's the script:

$key = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet     Settings\Connections'
$data = (Get-ItemProperty -Path $key -Name  DefaultConnectionSettings).DefaultConnectionSettings

if($data[8] -eq 11)
{
$data[8] = 3
Set-ItemProperty -Path $key -Name DefaultConnectionSettings -Value $data
}
elseif ($data[8] -eq 3){
$data[8] = 11
Set-ItemProperty -Path $key -Name DefaultConnectionSettings -Value $data
}
Moose
  • 751
  • 22
  • 42

1 Answers1

0

Change "$data[8] = 11" to "$data[8] = 9" and also "$data = 3" to "$data = 0". This ensures that second option stays off. check here: What key in windows registry disables IE connection parameter "Automatically Detect Settings"?

Community
  • 1
  • 1
Moose
  • 751
  • 22
  • 42