Results 1 to 3 of 3

Thread: How to change IE proxy using VBscript

  1. #1
    Join Date
    Mar 2009
    Posts
    89

    How to change IE proxy using VBscript

    Hello friends,

    I have heared form my friends that we can change proxy of Internet Explorer by using Vbscript, but they don't know I have also try to find it over internet but was not able to get the perfect i hope my someone would help me out over here.

  2. #2
    Join Date
    Dec 2008
    Posts
    164

    Re: How to change IE proxy using VBscript

    Sure i will help you out with this issue try to right click on you script make the following changes in the registry.

    HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings
    ProxyEnable -- > REG_DWORD Val '0' Off, '1' On
    ProxyOverride - -> REG_SZ Val ';' delimited

  3. #3
    Join Date
    Dec 2008
    Posts
    101

    Re: How to change IE proxy using VBscript

    I have found a solution for you try to use the following code i am sure it will work for you if this doesn't work than try to make some changes in this code only.

    Code:
    <script>
    Const HKCU=&H80000001 'HKEY_CURRENT_USER
    Const HKLM=&H80000002 'HKEY_LOCAL_MACHINE
    
    Const REG_SZ=1
    Const REG_EXPAND_SZ=2
    Const REG_BINARY=3
    Const REG_DWORD=4
    Const REG_MULTI_SZ=7
    
    Const HKCU_IE_PROXY = "Software\Microsoft\Windows\CurrentVersion\Internet
    Settings"
    
    Set oReg=GetObject("winmgmts:!root/default:StdRegProv")
    
    Main
    
    Sub Main()
    
    ' If Proxy is set then turn it off
    If GetValue(HKCU,HKCU_IE_PROXY,"ProxyEnable",REG_DWORD) = 1 AND
    Len(GetValue(HKCU,HKCU_IE_PROXY,"ProxyServer",REG_SZ)) > 0 Then
    CreateValue HKCU,HKCU_IE_PROXY,"ProxyEnable",0,REG_DWORD
    wscript.echo "Proxy Disabled"
    Else
    ' If Proxy is not set then turn it on
    
    strProxyServer = "MyProxySvr:80"
    strProxyOveride = "*.domain.com;*.domain2.com;*domain3.com"
    
    CreateValue HKCU,HKCU_IE_PROXY,"ProxyServer",strProxyServer,REG_SZ
    CreateValue HKCU,HKCU_IE_PROXY,"ProxyEnable",1,REG_DWORD
    CreateValue HKCU,HKCU_IE_PROXY,"ProxyOverride",strProxyOveride,REG_SZ
    wscript.echo "Proxy Enabled" & vbcrlf & "(" & strProxyServer & ")"
    End If
    
    End Sub
    
    Function CreateValue(Key,SubKey,ValueName,Value,KeyType)
    Select Case KeyType
    Case REG_SZ
    CreateValue = oReg.SetStringValue(Key,SubKey,ValueName,Value)
    Case REG_EXPAND_SZ
    CreateValue =
    oReg.SetExpandedStringValue(Key,SubKey,ValueName,Value)
    Case REG_BINARY
    CreateValue = oReg.SetBinaryValue(Key,SubKey,ValueName,Value)
    Case REG_DWORD
    CreateValue = oReg.SetDWORDValue(Key,SubKey,ValueName,Value)
    Case REG_MULTI_SZ
    CreateValue =
    oReg.SetMultiStringValue(Key,SubKey,ValueName,Value)
    End Select
    End Function
    
    Function DeleteValue(Key, SubKey, ValueName)
    DeleteValue = oReg.DeleteValue(Key,SubKey,ValueName)
    End Function
    
    Function GetValue(Key, SubKey, ValueName, KeyType)
    
    Dim Ret
    
    Select Case KeyType
    Case REG_SZ
    oReg.GetStringValue Key, SubKey, ValueName, Value
    Ret = Value
    Case REG_EXPAND_SZ
    oReg.GetExpandedStringValue Key, SubKey, ValueName, Value
    Ret = Value
    Case REG_BINARY
    oReg.GetBinaryValue Key, SubKey, ValueName, Value
    Ret = Value
    Case REG_DWORD
    oReg.GetDWORDValue Key, SubKey, ValueName, Value
    Ret = Value
    Case REG_MULTI_SZ
    oReg.GetMultiStringValue Key, SubKey, ValueName, Value
    Ret = Value
    End Select
    
    GetValue = Ret
    End Function
    </script>

Similar Threads

  1. MSI not allowing to change proxy server settings
    By Althea in forum Networking & Security
    Replies: 6
    Last Post: 19-04-2011, 10:22 PM
  2. Change FireFox proxy setting programmatically
    By Puloma in forum Software Development
    Replies: 4
    Last Post: 21-09-2010, 06:50 AM
  3. How to Change Permission in VBScript
    By Quattro in forum Software Development
    Replies: 3
    Last Post: 09-06-2009, 08:44 AM
  4. Vbscript to change mac address
    By Laler in forum Software Development
    Replies: 3
    Last Post: 04-06-2009, 10:16 AM
  5. Change Proxy Settings for LocalSystem account
    By PhilScott in forum Windows Server Help
    Replies: 8
    Last Post: 04-03-2009, 05:55 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,984,241.50698 seconds with 17 queries