Firefox user profiles

(imported topic written by mleeser91)

I need some help trying to modify Firefox user profile settings. Firefox creates a random folder to keep its settings in (C:\Documents and Settings<username>\Application Data\Mozilla\Firefox\Profiles\xxxxxxxx.default\prefs.js). Where xxxxxxxx is a random string of 8 characters.

I would like to do this for all user folders in C:\Documents and Settings\

Check if \Application Data\Mozilla\Firefox\Profiles\xxxxxxxx.default\prefs.js file exists

If yes append the following 3 lines to the prefs.js file:

user_pref(“app.update.auto”, false);

user_pref(“app.update.enabled”, false);

user_pref(“browser.search.update”, false);

Does anyone have any ideas on how to do this? The random folder names have got me stumped.

(imported comment written by jessewk)

I think this would work for you: http://forum.bigfix.com/viewtopic.php?id=4566

(imported comment written by mleeser91)

Thanks for the link. I’ve tested the first solution (all.js) and it does not work for existing profiles. If the user modifies their setting it does not get set back to the settings specified in all.js.

The second option for the user.js file works as expected. If a user changes their setting it is set back to the setting from the user.js file the next time firefox is started. However this file needs to be put in the “C:\Documents and Settings<username>\Application Data\Mozilla\Firefox\Profiles\xxxxxxxx.default” folder so I’ll still need to deal with the random folder names.

So I’ll need to create a user.js file with the following:

user_pref(“app.update.auto”, false);

user_pref(“app.update.enabled”, false);

user_pref(“browser.search.update”, false);

Go through each folder (profile) in the C:\Documents and Settings\

Copy the user.js file to the “\Application Data\Mozilla\Firefox\Profiles\xxxxxxxx.default” folder if it exists.

Does anyone want to take a stab at a fixlet for this?

(imported comment written by mleeser91)

I was able to create a script to do what I needed. It is for XP machines and it will put a user.js file into the “Application Data\Mozilla\Firefox\Profiles\xxxxxxxx.default” for all the user profiles that already have that folder.

Unfortunately some of my local user profile names contain a single space. This fixlet will handle profiles with no spaces in the name as well as profiles with one space in the name.

If a user manually sets their Firefox update preferences the settings will revert back to what is specified in the user.js file the next time Firefox is started.

The user.js file is copied to the Firefox install folder as a holding place only. Firefox will not use the file from this location. It must be put into the user’s profile folder.

Note, this fixlet was created to modify settings for users that already have existing profiles. I found that the user.js file works best for our environment. For other options to handle Firefox preferences check here https://developer.mozilla.org/En/A_Brief_Guide_to_Mozilla_Preferences

delete __appendfile delete __createfile delete ff.bat delete 
"C:\Program Files\Mozilla Firefox\defaults\pref\user.js"   appendfile user_pref(
"app.update.auto", 

false); appendfile user_pref(
"app.update.enabled", 

false); appendfile user_pref(
"browser.search.update", 

false);   move __appendfile 
"C:\Program Files\Mozilla Firefox\defaults\pref\user.js"   createfile until EOF @echo off 

for /F 
"tokens=1 delims=\" %%a in ('dir "C:\Documents and Settings\
" /b') do call :Sub1 %%a %%b 

goto :End :Sub1 

if %2 NEQ b (call :Sub2 %1 %2) 

else (call :Sub4 %1) 

goto :End :Sub2 

for /F 
"tokens=1 delims=\" %%b in ('dir "C:\Documents and Settings\%1 %2\Application Data\Mozilla\Firefox\Profiles\
" /b') do call :Sub3 %1 %2 %%b 

goto :End :Sub3 copy 
"C:\Program Files\Mozilla Firefox\defaults\pref\user.js" 
"C:\Documents and Settings\%1 %2\Application Data\Mozilla\Firefox\Profiles\%3\" 

goto :End :Sub4 

for /F 
"tokens=1 delims=\" %%b in ('dir "C:\Documents and Settings\%1\Application Data\Mozilla\Firefox\Profiles\
" /b') do call :Sub5 %1 %%b 

goto :End :Sub5 copy 
"C:\Program Files\Mozilla Firefox\defaults\pref\user.js" 
"C:\Documents and Settings\%1\Application Data\Mozilla\Firefox\Profiles\%2\" 

goto :End :End EOF   move __createfile ff.bat   waithidden ff.bat

(imported comment written by SystemAdmin)

mleeser

I was able to create a script to do what I needed. It is for XP machines and it will put a user.js file into the “Application Data\Mozilla\Firefox\Profiles\xxxxxxxx.default” for all the user profiles that already have that folder.

Unfortunately some of my local user profile names contain a single space. This fixlet will handle profiles with no spaces in the name as well as profiles with one space in the name.

If a user manually sets their Firefox update preferences the settings will revert back to what is specified in the user.js file the next time Firefox is started.

The user.js file is copied to the Firefox install folder as a holding place only. Firefox will not use the file from this location. It must be put into the user’s profile folder.

Note, this fixlet was created to modify settings for users that already have existing profiles. I found that the user.js file works best for our environment. For other options to handle Firefox preferences check here https://developer.mozilla.org/En/A_Brief_Guide_to_Mozilla_Preferences

delete __appendfile delete __createfile delete ff.bat delete
"C:\Program Files\Mozilla Firefox\defaults\pref\user.js" appendfile user_pref(
“app.update.auto”,

false); appendfile user_pref(
“app.update.enabled”,

false); appendfile user_pref(
“browser.search.update”,

false); move __appendfile
"C:\Program Files\Mozilla Firefox\defaults\pref\user.js" createfile until EOF @echo off

for /F
"tokens=1 delims=" %%a in (‘dir “C:\Documents and Settings
” /b’) do call :Sub1 %%a %%b

goto :End :Sub1

if %2 NEQ b (call :Sub2 %1 %2)

else (call :Sub4 %1)

goto :End :Sub2

for /F
"tokens=1 delims=" %%b in (‘dir “C:\Documents and Settings%1 %2\Application Data\Mozilla\Firefox\Profiles
” /b’) do call :Sub3 %1 %2 %%b

goto :End :Sub3 copy
"C:\Program Files\Mozilla Firefox\defaults\pref\user.js"
“C:\Documents and Settings%1 %2\Application Data\Mozilla\Firefox\Profiles%3”

goto :End :Sub4

for /F
"tokens=1 delims=" %%b in (‘dir “C:\Documents and Settings%1\Application Data\Mozilla\Firefox\Profiles
” /b’) do call :Sub5 %1 %%b

goto :End :Sub5 copy
"C:\Program Files\Mozilla Firefox\defaults\pref\user.js"
“C:\Documents and Settings%1\Application Data\Mozilla\Firefox\Profiles%2”

goto :End :End EOF move __createfile ff.bat waithidden ff.bat

Is this Fixlet run as a batch file? I have very little experience writing batch files, but this looks like exactly what I’m hoping to do (with different user_pref appends) for a batch file I’m going to need to push out through active directory on a local network.

(imported comment written by SystemAdmin)

While I discovered that the script itself is not directly a batch file, I was able to determine the parts that were. I ended up with the following:

if exist del 
"C:\Program Files\Mozilla Firefox\defaults\pref\user.js"   echo user_pref(
"capability.policy.policynames", 
"localfilelinks"); > user.js echo user_pref(
"capability.policy.localfilelinks.sites", 
"http://localwiki"); >> user.js echo user_pref(
"capability.policy.localfilelinks.checkloaduri.enabled", 
"allAccess"); >> user.js   move user.js 
"C:\Program Files\Mozilla Firefox\defaults\pref\"   

for /F 
"tokens=1 delims=\" %%a in ('dir "C:\Documents and Settings\
" /b') do call :Sub1 %%a %%b 

goto :End :Sub1 

if %2 NEQ b (call :Sub2 %1 %2) 

else (call :Sub4 %1) 

goto :End :Sub2 

for /F 
"tokens=1 delims=\" %%b in ('dir "C:\Documents and Settings\%1 %2\Application Data\Mozilla\Firefox\Profiles\
" /b') do call :Sub3 %1 %2 %%b 

goto :End :Sub3 copy 
"C:\Program Files\Mozilla Firefox\defaults\pref\user.js" 
"C:\Documents and Settings\%1 %2\Application Data\Mozilla\Firefox\Profiles\%3\" 

goto :End :Sub4 

for /F 
"tokens=1 delims=\" %%b in ('dir "C:\Documents and Settings\%1\Application Data\Mozilla\Firefox\Profiles\
" /b') do call :Sub5 %1 %%b 

goto :End :Sub5 copy 
"C:\Program Files\Mozilla Firefox\defaults\pref\user.js" 
"C:\Documents and Settings\%1\Application Data\Mozilla\Firefox\Profiles\%2\" 

goto :End :End

This updates on browser restart for every user account.

The user_pref lines are essentially the same lines you would find in Firefox’s about:config file. Anything you change there you can also automate with this batch file. Hopefully this helps someone else out there as well.