Jump to content
Sign in to follow this  

Removing registry entries at reboot

Recommended Posts


We use a proxy server at work and don't want to leave it on the customer's computer when we're done. In the rush to get things finished it often gets overlooked - causing problems when the customer gets home and can't connect (because the proxy's still in the registry).

Here's the code to start the proxy:

RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyEnable", "REG_DWORD", 00000001)
RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer", "REG_SZ", "xxx.xxx.xxx.xxx:8080")

Any suggestions on how to remove it at the next reboot?

Share this post

Link to post
Share on other sites

It seems like you have very trusting customers if they will allow you to run code to set those settings - if they will accept that action, then consider placing your script in their start-up folder.

Anytime that the script cannot ping your proxy server - it offers the user the option to remove those proxy settings. Once the script removes those settings - the script deletes itself.


Share this post

Link to post
Share on other sites

Not an autoIT script but drop this in the system32 directory. If the call and say they cannot connect have them run proxytoggle.vbs from the run line. Just basic vbscript...

const HKEY_CURRENT_USER = &H80000001
const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set wshell = createobject("wscript.shell") 
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
 strComputer & "\root\default:StdRegProv")
strKeyPath = "Software\Microsoft\Windows\CurrentVersion\Internet Settings"
strValueName = "proxyenable"
oReg.GetDWORDValue HKEY_CURRENT_USER,strKeyPath,strValueName,dwValue
'StdOut.WriteLine "Currently: " & dwValue 
If dwvalue <> 1 Then
    wshell.regwrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\proxyenable", "1", "REG_DWORD"
    enabled = True
    Else If dwvalue = 1 Then
            wshell.regwrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\proxyenable", "0", "REG_DWORD"
            enabled = False
    End If
End If
    MsgBox "Proxy Configured to be " & enabled
Set wshell = Nothing

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.