change user profile proxy settings

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Dipesh
Posts: 23
Joined: 13 Sep 2012 00:05

change user profile proxy settings

#1 Post by Dipesh » 26 Sep 2012 06:16

taskkill /im firefox.exe /f
taskkill /im explore.exe /f

cd\
set "users=Documents and Settings"
For /F "tokens=*" %%z in ('Dir /B /A:D "%users%"') Do ( call :part2 %%z)
:part2
set username=%1
set key=Software\Microsoft\Windows\CurrentVersion\Internet Settings
set val=ProxyEnable
set type=REG_DWORD
set data=0
reg load "HKU\%username%" "%profdir%\NTUSER.DAT"
reg add "HKU\%username%\%key%" /v "%val%" /t %type% /d %data% /f
reg unload "HKU\%username%"
cd "%users%\Local Settings\Application Data\Mozilla\Firefox\Profiles"
cd *.default
echo user_pref("network.proxy.type", 0); >>"prefs.js" (in this line when run is show 1 after ; why i don't know)

when i run this command it run show successful but nothing is happen please guide me...

OR any better way to do this task i have to remove proxy settings form both browser.

i am running this command with psexec with administrator profile & need to change in every user profile..

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: change user profile proxy settings

#2 Post by foxidrive » 26 Sep 2012 06:51

Dipesh wrote:taskkill /im firefox.exe /f
taskkill /im explore.exe /f

cd\
set "users=Documents and Settings"
For /F "tokens=*" %%z in ('Dir /B /A:D "%users%"') Do ( call :part2 %%z)
GOTO :EOF
:part2
set username=%1
set key=Software\Microsoft\Windows\CurrentVersion\Internet Settings
set val=ProxyEnable
set type=REG_DWORD
set data=0
reg load "HKU\%username%" "%profdir%\NTUSER.DAT"
reg add "HKU\%username%\%key%" /v "%val%" /t %type% /d %data% /f
reg unload "HKU\%username%"
cd "%users%\Local Settings\Application Data\Mozilla\Firefox\Profiles"
cd *.default
>>"prefs.js" echo user_pref("network.proxy.type", 0);


The two changes above will help, but I didn't study your code.

Post Reply