Jump to content

Recommended Posts

Posted
I would like a script to untick the 'automatically detect settings' box in Internet options. Group policy does not seem to handle this in the same way that it does the proxy server
Posted

Here's a PowerShell script that does what you need. Just change the number shown in red with one of the numbers shown in the table (in purple) depending upon whether you have the "Use a proxy server for your LAN" enabled or disabled.

 

$key = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections'
$data = (Get-ItemProperty -Path $key -Name DefaultConnectionSettings).DefaultConnectionSettings
$data[8] = [color="#FF0000"][b]3[/b][/color]

Set-ItemProperty -Path $key -Name DefaultConnectionSettings -Value $data

<#
   'Automatically detect settings' box 
-––––––––––––––––-–––––––––-–––––––––-------
                |  Checked  |  Unchecked  |
-––––––––––––––––––––––––––––––––––––-------
| Proxy enabled  |    [color="#800080"][b]11[/b][/color]     |      [color="#800080"][b]3[/b][/color]      |
-–––––––––––––––––––––––––––––––––––––------
| Proxy disabled |     [color="#800080"][b]9[/b][/color]     |      [color="#800080"][b]1[/b][/color]      |
-––––––––––––––––-–––––––––-–––––––––––-----
#>

 

Credits / More info

http://stackoverflow.com/a/15914470

http://stackoverflow.com/a/1674377

http://atyoung.blogspot.co.uk/2012/06/info-regarding-hkeycurrentusersoftwarem.html

  • 3 years later...
Posted

Hi,

How to run this code on Windows 7 64-bit machine as we cannot run .sh files on Windows. Please let me know.

And how to write a single script both for checking and unchecking the 'Automatically detect settings' checkbox.

I mean,

If it is already checked then the script should uncheck and if it is already unchecked the script should check it.

Can we have a script like this?

Thanks in advance.

Posted
How to run this code on Windows 7 64-bit machine as we cannot run .sh files on Windows.

The file extension for PowerShell scripts is .ps1.

 

how to write a single script both for checking and unchecking the 'Automatically detect settings' checkbox.

Here's another PowerShell script that will toggle the appropriate value on or off each time it is run.

 

$key  = "Registry::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections"
$name = "DefaultConnectionSettings"
$data = (Get-ItemProperty -Path $key -Name $name).$name
$byte = $data[8]

Switch ($byte) {
   9  { $data[8] = 1;  Set-ItemProperty -Path $key -Name $name -Value $data }
   1  { $data[8] = 9;  Set-ItemProperty -Path $key -Name $name -Value $data }
   11 { $data[8] = 3;  Set-ItemProperty -Path $key -Name $name -Value $data }
   3  { $data[8] = 11; Set-ItemProperty -Path $key -Name $name -Value $data }
}


<#
  'Automatically detect settings' values
-––––––––––––––––-–––––––––-–––––––––-------
                |  Checked  |  Unchecked  |
-––––––––––––––––––––––––––––––––––––-------
| Proxy enabled  |    11     |      3      |
-–––––––––––––––––––––––––––––––––––––------
| Proxy disabled |     9     |      1      |
-––––––––––––––––-–––––––––-–––––––––––-----
#>

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...