V
V
Vladislav2016-01-04 12:54:48
System administration
Vladislav, 2016-01-04 12:54:48

Application of changing parameters in the registry through a batch file?

There is a task to enable and disable the connection to the proxy in a simplified mode (for users) without a long drop in the settings. I decided to write a batch file.
Here is the code to turn it on (to turn it off in the corresponding place is 0):

@echo off
set REGDIR="HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings"

 REG ADD %REGDIR% /v ProxyEnable /t REG_DWORD /d 1 /f
echo "work"

rundll32 user32.dll,UpdatePerUserSystemParameters
gpupdate /force

The problem is, the checkbox is removed perfectly, but the proxy itself does not turn off (turns on) and continues to work in the same mode. How to force to apply the specified parameters, as you can see, updating group policies does not help.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
mureevms, 2016-01-04
@vladisvav_dmitrievich

1. Add Kerio restart to the script after changing the registry.
2. Use virtualization and forget about such problems.

R
res2001, 2016-01-04
@res2001

One change in the registry is clearly not enough - you still need to stop the proxy service (if the proxy is implemented by the service), done using the sc command, you can remotely. Or somehow force the proxy to reread the configuration in the registry - here you should already read the manuals for your proxy server.

N
numbnp, 2016-01-07
@numbnp

If the problem is that in the office the Internet is through a proxy and outside the office without it, then auto-configure the proxy in your network and forget about the problems.
habrahabr.ru/sandbox/19972

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question