First of all, the background of this issue: The company's proxy configuration script restrictions too strict, the development of their own host is often recognized as illegal address, this is very annoying, so I copied the company's configuration script is saved locally, and then made some changes, so that their host is legitimate, but more annoying, The company's security system will periodically restore the proxy configuration script to the official, so I hope I have a program can monitor the configuration of proxy settings, if not my own, immediately correct, to do this, first of all, you have to be able to modify the settings in a scripted way.
Many online use of script to modify the agent's article, are directly changed proxy server settings, check for a long time did not find what I want, but these articles are still very enlightening, ie these settings should all exist in the registration table. So I based on the current set of automatic configuration script a keyword in the registry search, found that the original is set here: [Hkey_local_machine\system\controlset001\services\nlasvc\parameters\ Internet\manualproxies]
This will be done, write the registry file or use the command line to modify this setting:
1, the registry method, edit a text file as follows:
REGEDIT4
[Hkey_local_machine\system\controlset001\services\nlasvc\parameters\internet\manualproxies]
@= "FilePath"
@ Represents the default value for this key, filepath can be "FILE://C:/SOME.PAC", which means a local file or a URL that uses a proxy file that is common on a network. Then save as Xxx.reg, and then double-click the saved file, the corresponding settings have been modified;
2. Command line mode, use the Red Add command:
Reg ADD hkey_local_machine\system\controlset001\services\nlasvc\parameters\internet\manualproxies/ve/d "Val"
This command means adding a key value to the registry, overwriting its value if it already exists,/ve representing the default value, or/D "Val" to use Val to set the key, and a detailed reg command to click Reg/? in the command prompt. Be sure to run with administrator privileges when using the command line mode, or you cannot modify it.
Now the problem is solved, just write a script to invoke the command-line command.