LKBEN10642: Howto set a proxy via registry in windows
LKB | Created: 02/04/2020 | Version: 0 | Language: EN | Rating: 0 | Outdated: False | Marked for deletion: False
Author: Wim Peeters - Keskon GmbH & Co. KG
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"
About the Author
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 in different European countries and different European languages. He writes knowledge base articles to solve IT problems and publishes them on the Lubby Knowledge Platform where he is one of the most important contributors and the main developer.