Proxy On-Off Script

Save As VBS file

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

DimSetting = WshShell.RegRead ("HKCUSOFTWAREMicrosoftWindowsCurrentVersionInternet SettingsProxyEnable")

If DimSetting = 1 Then 
'Wscript.Echo "Proxy is Currently Enabled"

returnvalue=MsgBox ("Do you want to DISABLE the Proxy?", 36, "Proxy state is Currently ENABLED")


if returnvalue = 6 then 
' BEGIN CALLOUT A
WshShell.RegWrite "HKCUSoftwareMicrosoftWindows" & _
 "CurrentVersionInternet SettingsProxyEnable", _
 0, "REG_DWORD"
' END CALLOUT A

wShshell.Run "taskkill /im iexplore.exe",0,True
WScript.Sleep 500 'give kill time to take effect

wShshell.Run "iexplore.exe"
End If
WScript.Quit


Else 
'Wscript.Echo "Proxy is Currently Disabled" 
End If


'On Error Resume Next

returnvalue=MsgBox ("Do you want to ENABLE the Proxy?", 36, "Proxy state is Currently DISABLED")

If returnvalue = "" Then
 WScript.Quit
End If

if returnvalue = 6 then 
' BEGIN CALLOUT A
WshShell.RegWrite "HKCUSoftwareMicrosoftWindows" & _
 "CurrentVersionInternet SettingsProxyEnable", _
 1, "REG_DWORD"
WshShell.RegWrite "HKCUSoftwareMicrosoftWindows" & _
 "CurrentVersionInternet SettingsProxyServer","proxy.test.edu:80", "REG_SZ"
WshShell.RegWrite "HKCUSoftwareMicrosoftWindows" & _
 "CurrentVersionInternet SettingsProxyOverride","<local>", "REG_SZ"
' END CALLOUT A


wShshell.Run "taskkill /im iexplore.exe",0,True

WScript.Sleep 500 'give kill time to take effect

wShshell.Run "iexplore.exe"
End If

WScript.Quit
Advertisements