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.
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
}