Share via

VBscript - how to Disable "Use Automatic configuration Script"

Anonymous
2015-04-09T13:10:09+00:00

Hi There

I currently have the below script in a vbs file;

Const HKEY_CURRENT_USER = &H80000001

Set objShell = CreateObject("WScript.Shell")

strPC = objShell.ExpandEnvironmentStrings("%COMPUTERNAME%")

On Error Resume Next

Set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\.\root\default:StdRegProv")

strKeyPath = "Software\Microsoft\Windows\CurrentVersion\Internet Settings"

strValueName = "ProxyEnable"

objReg.GetDWORDValue HKEY_CURRENT_USER,strKeyPath,strValueName,dwValue

'#==============================================================================

'# If IE Proxy is currently enabled display message and ask user whether it

'# should then be disabled

'#==============================================================================

If dwValue = 1 Then

IEPrompt = MsgBox ("Hello David. Your Proxy is on,  Do you want to turn it off?", vbQuestion+vbYesNo, "Disable IE Proxy")

If IEPrompt = vbYes Then

dwValue = 0

objReg.SetDWORDValue HKEY_CURRENT_USER,strKeyPath,strValueName,dwValue

MsgBox "Thank You David, your proxy is now off. Have a nice day" & _

".",vbInformation, "Disable IE Proxy"

ElseIf IEPrompt = vbNo Then

MsgBox "David, your Proxy is still on " & _

".",vbInformation, "Disable IE Proxy"

End If

'#==============================================================================

'# If IE Proxy is currently disabled display message and ask user whether it

'# should then be enabled

'#==============================================================================

ElseIf dwValue = 0 Then

IEPrompt = MsgBox ("Hello David. Your Proxy is off,  Do you want to turn it on?", vbQuestion+vbYesNo, "Enable IE Proxy")

If IEPrompt = vbYes Then

dwValue = 1

objReg.SetDWORDValue HKEY_CURRENT_USER,strKeyPath,strValueName,dwValue

MsgBox "Thank You David, your proxy is now on. Have a wonderful day" & _

".",vbInformation, "Enable IE Proxy"

ElseIf IEPrompt = vbNo Then

MsgBox "David, your Proxy is still on" & _

".",vbInformation, "Enable IE Proxy"

End If

End If

This only turns off the proxy server in IE/Tools/Internet Options/Connections/Lan Settings.

Can I get this same code to turn of the 'Automatic configuration' check boxes instead or as well?

Many thanks

Luke

Windows for home | Windows 11 | Internet and connectivity

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

0 additional answers

Sort by: Most helpful