Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Mozilla FireFox deployment customisation
<#
.SYNOPSIS
Mozilla FireFox deployment customisation
.DESCRIPTION
Mozilla FireFox deployment customisation for 64bit Windows based installation.
This version supports 64Bit only. If you plan to use it with a 32Bit deployment, you will
need to tweak the Path (at least if the OS is 64Bit)
.EXAMPLE
PS C:\> .\FireFox_Tweaks.ps1
.NOTES
Usedd to deploy a streamlined Mozilla Firefox accross the Enterprise by using EMCO remote
Installer. It should work with all deployment tools that support PowerShell Script execution
as part of the deployment. A friend tested it with SCCM and it worked just fine.
#>
#requires -Version 2.0
$ENC = 'UTF8'
$SC = 'SilentlyContinue'
$targetDir = "$env:ProgramFiles\Mozilla Firefox\defaults\pref\"
$CFGTargetDir = "$env:ProgramFiles\Mozilla Firefox\"
$OverrideTargetDir = "$env:ProgramFiles\Mozilla Firefox\browser\"
$userChromeTargetDir = "$env:ProgramFiles\Mozilla Firefox\browser\profile\chrome\"
$CustomConfig = 'mozilla.cfg'
$CustomOverride = 'override.ini'
$AutoConfig = 'autoconfig.js'
$UserChromeCssName = 'userChrome.css'
If (Test-Path -Path $targetDir -ErrorAction $SC -WarningAction $SC)
{
$AutoCfg = ($targetDir + $AutoConfig)
$MozillaCfg = ($CFGTargetDir + $CustomConfig)
$OverrideIni = ($OverrideTargetDir + $CustomOverride)
$UserChromeCss = ($userChromeTargetDir + $UserChromeCssName)
#region CreateStructure
# Create the missing structure
If (-not (Test-Path -Path $userChromeTargetDir -ErrorAction $SC -WarningAction $SC))
{
$paramNewItem = @{
Path = $userChromeTargetDir
ItemType = 'directory'
Force = $true
Confirm = $false
ErrorAction = $SC
WarningAction = $SC
}
$null = (New-Item @paramNewItem)
}
#endregion CreateStructure
#region UserChromeCss
If (Test-Path -Path $UserChromeCss -ErrorAction $SC -WarningAction $SC)
{
$paramRemoveItem = @{
Force = $true
ErrorAction = $SC
WarningAction = $SC
Confirm = $false
}
$null = (Remove-Item $UserChromeCss @paramRemoveItem)
}
[string]$UserChromeCssContent = '/* UserChrome.css for Mozilla Firefox */
/* Remove access to user interface elements that are not suitable for application virtualization */
/* Options - Advanced - General - System Defaults */
#systemDefaultsGroup { display: none !important; }
/* Options / Advanced / Update / Firefox updates group box */
#updateApp { display: none !important; }
/* Help - About - Check for Updates button */
#updateButton { display: none !important; }
'
$paramSetContent = @{
Path = $UserChromeCss
Value = $UserChromeCssContent
Force = $true
Encoding = $ENC
ErrorAction = $SC
WarningAction = $SC
}
$null = (Set-Content @paramSetContent)
#endregion UserChromeCss
#region AutoCfg
If (Test-Path -Path $AutoCfg -ErrorAction $SC -WarningAction $SC)
{
$paramRemoveItem = @{
Force = $true
ErrorAction = $SC
WarningAction = $SC
Confirm = $false
}
$null = (Remove-Item $AutoCfg @paramRemoveItem)
}
[string]$AutoCfgContent = 'pref("general.config.filename", "mozilla.cfg");
pref("general.config.obscure_value", 0);
'
$paramSetContent = @{
Path = $AutoCfg
Value = $AutoCfgContent
Force = $true
Encoding = $ENC
ErrorAction = $SC
WarningAction = $SC
}
$null = (Set-Content @paramSetContent)
#endregion AutoCfg
#region MozillaCfg
If (Test-Path -Path $MozillaCfg -ErrorAction $SC -WarningAction $SC)
{
$paramRemoveItem = @{
Force = $true
ErrorAction = $SC
WarningAction = $SC
Confirm = $false
}
$null = (Remove-Item $MozillaCfg @paramRemoveItem)
}
[string]$TargetContent = '//
lockPref("browser.startup.homepage_override.mstone", "ignore");
lockPref("browser.shell.checkDefaultBrowser", false);
lockPref("app.update.enabled", false);
lockPref("app.update.auto", false);
lockPref("app.update.mode", 0);
lockPref("app.update.service.enabled", false);
lockPref("datareporting.healthreport.service.enabled", false);
lockPref("datareporting.healthreport.uploadEnabled", false);
lockPref("datareporting.policy.dataSubmissionEnabled", false);
lockPref("toolkit.crashreporter.enabled", false);
Components.classes["@mozilla.org/toolkit/crash-reporter;1"].getService(Components.interfaces.nsICrashReporter).submitReports = false;
pref("browser.rights.3.shown", true);
pref("plugins.notifyMissingFlash", false);
pref("browser.shell.shortcutFavicons",true);
pref("browser.urlbar.trimURLs", false);
pref("browser.startup.homepage_override.mstone","ignore");
pref("geo.enabled", false);
pref("geo.wifi.uri", "");
pref("dom.battery.enabled", false);
pref("dom.gamepad.enabled", false);
pref("media.video_stats.enabled", false);
defaultPref("browser.startup.homepage","data:text/plain,browser.startup.homepage=http://www.enatec.io");
defaultPref("security.enterprise_roots.enabled", true);
defaultPref("network.automatic-ntlm-auth.allow-proxies", true);
defaultPref("network.automatic-ntlm-auth.trusted-uris", "build.enatec.net,sso.enatec.net,outlook.enatec.net,*.enatec.net");
defaultPref("browser.startup.page", 1);
defaultPref("config.lockdown.disable_themes", true);
defaultPref("browser.download.manager.closeWhenDone", true);
defaultPref("dom.disable_open_during_load", true);
defaultPref("permissions.default.image", 1);
defaultPref("javascript.enabled", true);
defaultPref("pref.advanced.javascript.disable_button.advanced", false);
defaultPref("security.enable_java", true);
defaultPref("security.default_personal_cert", "Ask Every Time");
defaultPref("browser.download.manager.showWhenStarting", false);
defaultPref("browser.download.manager.closeWhenDone", true);
defaultPref("browser.download.useDownloadDir", true);
defaultPref("browser.download.folderList", 2);
defaultPref("browser.tabs.autoHide", false);
defaultPref("browser.tabs.loadInBackground", false);
defaultPref("browser.history_expire_days", 7);
defaultPref("browser.history_expire_days.mirror", 7);
defaultPref("privacy.sanitize.sanitizeOnShutdown", true);
defaultPref("privacy.item.cookies", false);
defaultPref("privacy.item.downloads", false);
defaultPref("privacy.item.formdata", false);
defaultPref("privacy.item.history", false);
defaultPref("privacy.item.cache", true);
defaultPref("privacy.item.sessions", true);
defaultPref("privacy.sanitize.promptOnSanitize", false);
defaultPref("browser.safebrowsing.enabled", true);
defaultPref("general.smoothScroll", true);
defaultPref("general.autoScroll", false);
defaultPref("privacy.item.cache", true);
defaultPref("privacy.item.sessions", true);
defaultPref("network.cookie.cookieBehavior", 3);
defaultPref("browser.search.countryCode", "DE");
defaultPref("browser.search.hiddenOneOffs", "Amazon.com,Twitter,Wikipedia (en)");
defaultPref("browser.search.region", "DE");
defaultPref("browser.link.open_newwindow", 2);
defaultPref("browser.newtabpage.enhanced", true);
defaultPref("browser.newtabpage.storageVersion", 1);
defaultPref("network.predictor.cleaned-up", true);
defaultPref("gfx.direct2d.disabled", true);
defaultPref("layers.acceleration.disabled", true);
defaultPref("browser.cache.disk_cache_ssl", false);
defaultPref("privacy.donottrackheader.enabled", true);
defaultPref("privacy.donottrackheader.value", 1);
defaultPref("security.dialog_enable_delay", 2000);
defaultPref("security.enable_ssl3", true);
defaultPref("security.enable.tls", true);
lockPref("breakpad.reportURL", "");
lockPref("browser.tabs.crashReporting.sendReport", false);
lockPref("datareporting.healthreport.documentServerURI", "");
lockPref("datareporting.healthreport.service.enabled", false);
lockPref("datareporting.healthreport.uploadEnabled", false);
lockPref("datareporting.policy.dataSubmissionEnabled", false);
lockPref("datareporting.policy.dataSubmissionEnabled.v2", false); // Firefox 43+ ?
lockPref("dom.ipc.plugins.flash.subprocess.crashreporter.enabled", false);
lockPref("dom.ipc.plugins.reportCrashURL", false);
lockPref("toolkit.telemetry.archive.enabled", false);
lockPref("toolkit.telemetry.cachedClientID", "");
lockPref("toolkit.telemetry.enabled", false);
lockPref("toolkit.telemetry.prompted", 2);
lockPref("toolkit.telemetry.rejected", true);
lockPref("toolkit.telemetry.server", "");
lockPref("toolkit.telemetry.unified", false);
lockPref("toolkit.telemetry.unifiedIsOptIn", true);
lockPref("toolkit.telemetry.optoutSample", false);
lockPref("identity.fxaccounts.auth.uri", "");
lockPref("identity.fxaccounts.remote.force_auth.uri", "");
lockPref("identity.fxaccounts.remote.signin.uri", "");
lockPref("identity.fxaccounts.remote.signup.uri", "");
lockPref("identity.fxaccounts.settings.uri", "");
lockPref("services.sync.autoconnect", false);
lockPref("services.sync.engine.addons", false);
lockPref("services.sync.engine.bookmarks", false);
lockPref("services.sync.engine.history", false);
lockPref("services.sync.engine.passwords", false);
lockPref("services.sync.engine.prefs", false);
lockPref("services.sync.engine.tabs", false);
lockPref("services.sync.serverURL", "");
lockPref("breakpad.reportURL", "");
lockPref("browser.tabs.crashReporting.sendReport", false);
lockPref("datareporting.healthreport.documentServerURI", "");
lockPref("datareporting.healthreport.service.enabled", false);
lockPref("datareporting.healthreport.uploadEnabled", false);
lockPref("datareporting.policy.dataSubmissionEnabled", false);
lockPref("datareporting.policy.dataSubmissionEnabled.v2", false); // Firefox 43+ ?
lockPref("dom.ipc.plugins.flash.subprocess.crashreporter.enabled", false);
lockPref("dom.ipc.plugins.reportCrashURL", false);
lockPref("toolkit.telemetry.archive.enabled", false);
lockPref("toolkit.telemetry.cachedClientID", "");
lockPref("toolkit.telemetry.enabled", false);
lockPref("toolkit.telemetry.prompted", 2);
lockPref("toolkit.telemetry.rejected", true);
lockPref("toolkit.telemetry.server", "");
lockPref("toolkit.telemetry.unified", false);
lockPref("toolkit.telemetry.unifiedIsOptIn", true);
lockPref("toolkit.telemetry.optoutSample", false);
lockPref("browser.safebrowsing.enabled", false);
lockPref("browser.safebrowsing.downloads.enabled", false);
lockPref("browser.safebrowsing.malware.enabled", false);
lockPref("browser.urlbar.filter.javascript", true);
lockPref("network.cookie.cookieBehavior", 1);
lockPref("plugin.state.flash", 2);
lockPref("browser.pocket.enabled", false);
lockPref("signon.expireMasterPassword", true);
lockPref("browser.cache.disk.capacity", 1024);
lockPref("browser.cache.disk.smart_size.enabled", false);
lockPref("browser.cache.disk.smart_size.first_run", false);
lockPref("browser.cache.disk.smart_size.use_old_max", false);
'
$paramSetContent = @{
Path = $MozillaCfg
Value = $TargetContent
Force = $true
Encoding = $ENC
ErrorAction = $SC
WarningAction = $SC
}
$null = (Set-Content @paramSetContent)
#endregion MozillaCfg
#region OverrideIni
If (Test-Path -Path $OverrideIni -ErrorAction $SC -WarningAction $SC)
{
$paramRemoveItem = @{
Force = $true
ErrorAction = $SC
WarningAction = $SC
Confirm = $false
}
$null = (Remove-Item $OverrideIni @paramRemoveItem)
}
[string]$TargetContent = '[XRE]
EnableProfileMigrator=false
'
$paramSetContent = @{
Path = $OverrideIni
Value = $TargetContent
Force = $true
Encoding = $ENC
ErrorAction = $SC
WarningAction = $SC
}
$null = (Set-Content @paramSetContent)
#endregion OverrideIni
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.