我正在尝试在IE中设置所有连接设置。
我已经找到了如何在路径中修改大部分内容:
HKEY_CURRENT_USER \ Software \ Microsoft \ Windows \ CurrentVersion \ Internet Settings
但我找不到设置或取消设置“自动检测设置”的参数。
任何帮助?
答案 0 :(得分:42)
我找到了解决方案:它是此密钥的第9个字节:
[HKEY_CURRENT_USER \ Software \ Microsoft \ Windows \ CurrentVersion \ Internet Settings \ Connections] “DefaultConnectionSettings”= hex:3c,00,00,00,1f,00,00,00, 05 ,00,00,00,00,00,00,00,00,00,00 ,00,00,00,00,00,01,00,00,00,1f,00,00,00,68,74,74,70,3a,2f,2f,31,34,34,2e,31 ,33,31,2e,32,32,32,2e,31,36,37,2f,77,70,61,64,2e,64,61,74,90,0e,1e,66,d3,88 ,c5,01,01,00,00,00,8d,a8,4e,9E,00,00,00,00,00,00,00,00
这是一个位域:
屏蔽0x8将其关闭,即如果它高于8则减去8.
感谢Jamie google groups。
<强>更新强>
根据WhoIsRich的VBScript结合本答案中的详细信息,这里有一个PowerShell脚本来修改这些&amp;相关设置:
function Set-ProxySettings {
[CmdletBinding()]
param ( #could improve with parameter sets
[Parameter(Mandatory = $false)]
[bool]$AutomaticDetect = $true
,
[Parameter(Mandatory = $false)]
[bool]$UseProxyForLAN = $false
,
[Parameter(Mandatory = $false)]
[AllowNull()][AllowEmptyString()]
[string]$ProxyAddress = $null
,
[Parameter(Mandatory = $false)]
[int]$ProxyPort = 8080 #closest we have to a default port for proxies
,
[AllowNull()][AllowEmptyString()]
[bool]$UseAutomaticConfigurationScript = $false
)
begin {
[string]$ProxyRegRoot = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings'
[string]$DefaultConnectionSettingsPath = (Join-Path $ProxyRegRoot 'Connections')
[byte]$MaskProxyEnabled = 2
[byte]$MaskUseAutomaticConfigurationScript = 4
[byte]$MaskAutomaticDetect = 8
[int]$ProxyConnectionSettingIndex = 8
}
process {
#this setting is affected by multiple options, so fetch once here
[byte[]]$DefaultConnectionSettings = Get-ItemProperty -Path $DefaultConnectionSettingsPath -Name 'DefaultConnectionSettings' | Select-Object -ExpandProperty 'DefaultConnectionSettings'
#region auto detect
if($AutomaticDetect) {
Set-ItemProperty -Path $ProxyRegRoot -Name AutoDetect -Value 1
$DefaultConnectionSettings[$ProxyConnectionSettingIndex] = $DefaultConnectionSettings[$ProxyConnectionSettingIndex] -bor $MaskAutomaticDetect
} else {
Set-ItemProperty -Path $ProxyRegRoot -Name AutoDetect -Value 0
$DefaultConnectionSettings[$ProxyConnectionSettingIndex] = $DefaultConnectionSettings[$ProxyConnectionSettingIndex] -band (-bnot $MaskAutomaticDetect)
}
#endregion
#region defined proxy
if($UseProxyForLAN) {
if(-not ([string]::IsNullOrWhiteSpace($ProxyAddress))) {
Set-ItemProperty -Path $ProxyRegRoot -Name ProxyServer -Value ("{0}:{1}" -f $ProxyAddress,$ProxyPort)
}
Set-ItemProperty -Path $ProxyRegRoot -Name ProxyEnable -Value 1
$DefaultConnectionSettings[$ProxyConnectionSettingIndex] = $DefaultConnectionSettings[$ProxyConnectionSettingIndex] -bor $MaskProxyEnabled
} else {
Set-ItemProperty -Path $ProxyRegRoot -Name ProxyEnable -Value 0
$DefaultConnectionSettings[$ProxyConnectionSettingIndex] = $DefaultConnectionSettings[$ProxyConnectionSettingIndex] -band (-bnot $MaskProxyEnabled)
}
#endregion
#region config script
if($UseAutomaticConfigurationScript){
$DefaultConnectionSettings[$ProxyConnectionSettingIndex] = $DefaultConnectionSettings[$ProxyConnectionSettingIndex] -bor $MaskUseAutomaticConfigurationScript
}else{
$DefaultConnectionSettings[$ProxyConnectionSettingIndex] = $DefaultConnectionSettings[$ProxyConnectionSettingIndex] -band (-bnot $MaskUseAutomaticConfigurationScript)
}
#endregion
#persist the updates made above
Set-ItemProperty -Path $DefaultConnectionSettingsPath -Name 'DefaultConnectionSettings' -Value $DefaultConnectionSettings
}
}
答案 1 :(得分:9)
控制此设置的另一种方法是使用this blog post上提到的未记录的注册表项AutoDetect = 0:
注册表项:
HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\
DWORD
AutoDetect
= 0或1
所以关闭它的.reg文件看起来像:
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings]
"AutoDetect"=dword:00000000
答案 2 :(得分:5)
对于想要取消勾选“自动检测设置”框而不覆盖注册表项中包含的其他设置的任何人,您可以在登录时使用vbscript。
On Error Resume Next
Set oReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
sKeyPath = "Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections"
sValueName = "DefaultConnectionSettings"
' Get registry value where each byte is a different setting.
oReg.GetBinaryValue &H80000001, sKeyPath, sValueName, bValue
' Check byte to see if detect is currently on.
If (bValue(8) And 8) = 8 Then
' Turn off detect and write back settings value.
bValue(8) = bValue(8) And Not 8
oReg.SetBinaryValue &H80000001, sKeyPath, sValueName, bValue
End If
Set oReg = Nothing
答案 3 :(得分:2)
我知道这个问题有点陈旧,但我认为我的小更新可以帮助其他程序员。
我不想修改WhoIsRich answer,因为它真的很棒,但我根据自己的需要对其进行了调整:
如果自动检测设置 未选中,则检查。
On Error Resume Next
Set oReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
sKeyPath = "Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections"
sValueName = "DefaultConnectionSettings"
' Get registry value where each byte is a different setting.
oReg.GetBinaryValue &H80000001, sKeyPath, sValueName, bValue
' Check byte to see if detect is currently on.
If (bValue(8) And 8) = 8 Then
' To change the value to Off.
bValue(8) = bValue(8) And Not 8
' Check byte to see if detect is currently off.
ElseIf (bValue(8) And 8) = 0 Then
' To change the value to On.
bValue(8) = bValue(8) Or 8
End If
'Write back settings value
oReg.SetBinaryValue &H80000001, sKeyPath, sValueName, bValue
Set oReg = Nothing
最后,您只需要在 .VBS 文件(VBScript)中save并运行它。
答案 4 :(得分:1)
如果只是禁用每30分钟执行一次的组策略,则可以取消选中该框,然后将权限更改为只读。
答案 5 :(得分:1)
我已经使用了一个组合的答案,并制作了一个PowerShell脚本,为您提供了诀窍
$name = $PSScriptRoot + "\" + $MyInvocation.MyCommand.Name
if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) { Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$name`"" -Verb RunAs; exit }
$registryPath = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings"
$Name = "AutoDetect"
$value = "0"
New-ItemProperty -Path $registryPath -Name $name -Value $value ` -PropertyType DWORD -Force | Out-Null
Read-Host -Prompt "press Enter to Continue"
脚本将以admin身份运行,并将值更改为0(禁用自动检测)。
答案 6 :(得分:0)
您始终只需导出注册表,更改设置,然后再次导出注册表并执行差异。
答案 7 :(得分:0)
我可以确认这是有效的。我在完成调整后导出了reg文件,然后将其放入如下的登录脚本中:
REM ------ IE Auto Detect Settings FIX ------------------
REG IMPORT \\mydomain.local\netlogon\IE-Autofix.reg 2>NUL
答案 8 :(得分:0)
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Internet Explorer\Control Panel]
"Connection Settings"=dword:00000000
"Connwiz Admin Lock"=dword:00000000
"Autoconfig"=dword:00000000
"Proxy"=dword:00000000
"ConnectionsTab"=dword:00000000
答案 9 :(得分:0)
我认为您可以更改&#34;自动检测设置&#34;通过注册表项名称&#34; AutoConfigURL &#34;。这是我在c#中检查的代码。 祝你好运。
RegistryKey registry = Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings", true);
if(registry.GetValue("AutoConfigURL") != null)
{
//Proxy Server disabled (Untick Proxy Server)
registry.DeleteValue("AutoConfigURL");
}
答案 10 :(得分:0)
复活这个。
以下是如何在易于遵循的 powershell 中简洁地修改注册表项二进制值的方法。在此示例中,DefaultConnectionSettings
是我们尝试修改的具有 REG_BINARY
值的注册表项。
$path = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections"
$objName = "DefaultConnectionSettings"
$getObj = Get-ItemProperty -path $path -name $objName
$getObj.DefaultConnectionSettings[8] = 1
$objValue = $getObj.DefaultConnectionSettings
Set-ItemProperty -path $path -name $objName -Value $objValue
当您将 Get-ItemProperty
用于具有 REG_BINARY 值的注册表项时,它会在集合中为您提供许多子对象。
通过引用项目的名称(在这种情况下我们做 getObj.DefaultConnectionSettings
)作为 getObj 的子对象,我们得到一个 array 值,其中每个二进制值(即 { {1}}) 在数组中有自己的位置。
因为它是一个数组,我们可以很容易地引用、修改和迭代它,我们可以通过执行 50,33,01,00,00,00,00,00,04
或任何你想要的数字来代替 8 来修改一个值。8 指的是第 9 个值在数组中。在 $getObj.DefaultConnectionSettings[8] = 1
的示例中,第 9 位是 50,33,01,00,00,00,00,00,04
。 请记住,与其他事物一样,数组从 0 开始计数。
将其设置为 04
会将二进制中的 = 1
值更改为 04
,同时保留数组中的其余值不变。
最后,我们使用 01
希望这对其他人有帮助。
答案 11 :(得分:-1)
实际上,第9个字节表示按钮的检查状态,但上面的答案没有考虑启用手动配置的复选框。 该检查状态值也出现在该第九字节中。 因此,真正的答案应该是:
字节值
00001001 =检查手动代理
00000101 =选中使用自动配置脚本
00000011 =检查自动检测设置
当选中多个复选框时,第9个字节的值是对选中复选框的值进行按位OR运算的结果。