LKBEN10642: Howto set a proxy via registry in windows


Symptom

You need to set some registry settings for a proxy under windows. You want to do it via a logon script.

Cause

None

Solution

You can write a few lines of vbscript which can set the settings or import a certain registry file.

The registry file should look a bit like the following. Please note, this is an example and has to be changed for your environment.

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings]
"ProxyServer"="Theproxy:8080"
"ProxyOverride"="Lubbyserver;mailhost;10.47.*;http://Somesite*;10.46.*;10.65.*;<local>"
"ProxyEnable"=dword:00000001

To load via a vbscript you can insert something like:

Dim WshShell
Set WshShell = WScript.CreateObject("WScript.Shell") 

WshShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyServer", "Theproxy:8080", "REG_SZ"
WshShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyEnable", 1, "REG_DWORD"
 

Disclaimer:

The information provided in this document is intended for your information only. Lubby makes no claims to the validity of this information. Use of this information is at own risk!

About the Author

Author: Wim Peeters - Keskon GmbH & Co. KG

Wim Peeters is electronics engineer with an additional master in IT and over 30 years of experience, including time spent in support, development, consulting, training and database administration. Wim has worked with SQL Server since version 6.5. He has developed in C/C++, Java and C# on Windows and Linux. He writes knowledge base articles to solve IT problems and publishes them on the Lubby Knowledge Platform.