【问题标题】:How to toggle "Use automatic configuration script"如何切换“使用自动配置脚本”
【发布时间】:2021-09-29 04:26:32
【问题描述】:

WhoIsRich 发布了一个很棒的脚本来切换自动检测设置。你能告诉我如何设置使用自动配置脚本吗?原贴于What key in windows registry disables IE connection parameter "Automatically Detect Settings"?

【问题讨论】:

  • 所以你只想知道如何执行那个 vbscript 文件?
  • 请提供更多背景信息以及您想要实现的目标

标签: internet-explorer


【解决方案1】:

设置

reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v AutoConfigURL /t REG_SZ /d "http://www-abc.com:1234/sample.pac" /f

删除

这与取消选中“使用自动配置脚本”相同

reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v AutoConfigURL /t REG_SZ /d "" /f

【讨论】:

  • 要删除,需要使用“Reg delete”删除密钥,并且最好在编辑注册表之前进行备份。 备份Reg export "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" C:\temp\InternetSettings.reg 删除Reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v AutoConfigURL /f
  • “删除”似乎没有取消选中。它设置为“/f”的值。
  • 添加为 CMD 快捷方式添加以下C:\Windows\System32\cmd.exe /c reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v AutoConfigURL /t REG_SZ /d "" /f
【解决方案2】:

您可以在设置中保存您的代理并使用此 vbs 脚本来关闭代理..

Option Explicit
Dim WSHShell, strSetting
Set WSHShell = WScript.CreateObject("WScript.Shell")

'Determine current proxy setting and toggle to oppisite setting
strSetting = wshshell.regread("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyEnable")
If strSetting = 1 Then
NoProxy
Else Proxy
End If

'Subroutine to Toggle Proxy Setting to ON
Sub Proxy
WSHShell.regwrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyEnable", 1, "REG_DWORD"
wScript.Echo "Proxy is On"
wScript.Sleep 2500	
wshShell.SendKeys "{TAB}"
wScript.Sleep 25000
wshShell.SendKeys "{ENTER}"


End Sub	



'Subroutine to Toggle Proxy Setting to OFF
Sub NoProxy
WSHShell.regwrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyEnable", 0, "REG_DWORD"
wScript.Echo "Proxy is Off"
WScript.Sleep 2500
WshShell.SendKeys "{TAB}"	
WScript.Sleep 2500
WshShell.SendKeys "{ENTER}"
End Sub

【讨论】:

  • 代理启用/禁用与“自动检测设置”或“使用自动配置脚本”不同。它们实际上是相互独立的。检查注册表目录以查看诸如“ProxyEnable”之类的键
【解决方案3】:

我们最近需要跨多个工作站删除旧的 PAC 文件条目,并且使用登录脚本/GPO 不可行,因此我们使用 powershell 命令删除所有工作站上所有用户配置文件中的条目。理想情况下,您希望在系统用户上下文中运行它,但可以作为域管理员运行。

$localprofiles = gci C:\Users -Name | Sort-Object

foreach($localprofile in $localprofiles){
    reg load "hku\$localprofile" "C:\Users\$localprofile\ntuser.dat"
    write-host "Loaded $localprofile"
    reg delete "hku\$localprofile\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings" /v "AutoConfigURL" /f
    reg unload "hku\$localprofile"
    write-host "Unloaded $localprofile"
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-07-11
    • 1970-01-01
    • 2012-06-11
    • 2018-06-08
    • 2021-04-09
    • 1970-01-01
    相关资源
    最近更新 更多