Windows script for enabling proxy and disabling it

medicnick83

Paramedic
Joined
Aug 23, 2006
Messages
20,554
Hi all,

I went to help a person today with their printer and saw they had a windows script for enabling and disabling proxy on their PC.
They also used FortiClient for work related purposes.

Is anyone able to create this 'script' for me or show me how to do it?
Hers would pop up "Proxy ON" and "Proxy OFF"

We also use VPN/FortiClient but our users do it manually (enabling and disabling) and via control panel>internet options etc.

Would really appreciate it.

EDIT: Oh, I did ask if I could copy it, but she kindly said she can't share it (which I understand)
 

Hamish McPanji

Honorary Master
Joined
Oct 29, 2009
Messages
39,960
At elevated command prompt

Enable proxy : netsh winhttp set proxy :

Reset proxy : netsh winhttp reset proxy
 

simm_card

Expert Member
Joined
Aug 4, 2011
Messages
3,410
Open a new Notepad.txt, copy the below contents to it, and save the .txt as a .vbs. Double-click the one you need to action.

Save as Enable.vbs

Code:
Const HKEY_CURRENT_USER = &H80000001

strComputer = "."
Set objRegistry = GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")

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

strValueName = "ProxyEnable"
dwValue = 1
objRegistry.SetDWORDValue HKEY_CURRENT_USER, strKeyPath, strValueName, dwValue
Save as Disable.vbs

Code:
Const HKEY_CURRENT_USER = &H80000001

strComputer = "."
Set objRegistry = GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")

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

strValueName = "ProxyEnable"
dwValue = 0
objRegistry.SetDWORDValue HKEY_CURRENT_USER, strKeyPath, strValueName, dwValue
 
Last edited:

Cray

Honorary Master
Joined
Oct 11, 2010
Messages
21,919
Hi all,

I went to help a person today with their printer and saw they had a windows script for enabling and disabling proxy on their PC.
They also used FortiClient for work related purposes.

Is anyone able to create this 'script' for me or show me how to do it?
Hers would pop up "Proxy ON" and "Proxy OFF"

We also use VPN/FortiClient but our users do it manually (enabling and disabling) and via control panel>internet options etc.

Would really appreciate it.

EDIT: Oh, I did ask if I could copy it, but she kindly said she can't share it (which I understand)
You could also look at something like this if you don't want to go the script route...

https://www.proxyswitcher.com/download.html

The lite version is free...
 
Top