Where did you install Firefox from? Help Mozilla uncover 3rd party websites that offer problematic Firefox installation by taking part in our campaign. There will be swag, and you'll be featured in our blog if you manage to report at least 10 valid reports!

Поиск в Поддержке

Избегайте мошенников, выдающих себя за службу поддержки. Мы никогда не попросим вас позвонить, отправить текстовое сообщение или поделиться личной информацией. Сообщайте о подозрительной активности, используя функцию «Пожаловаться».

Learn More

Can I modify Firefox config (pref.js) using Powershell

more options

I tried to script a PS to make changes to the Pref.js file; however, the changes do not stick? Is this is expected or done by default is there a way that I can modify the file without going to which single system?

PS Script

$TopDir = "$env:APPDATA\Mozilla\Firefox\Profiles" $FileName = 'prefs.js'

$DefaultProfileDir = (Get-ChildItem -LiteralPath $TopDir -Directory). Where({

  $_.FullName -match '\.default'
  }).FullName

$FullFileName = Join-Path -Path $DefaultProfileDir -ChildPath $FileName

$Data = foreach($line in Get-Content $FullFileName) {

if( ($line.IndexOf('network.automatic-ntlm-auth.trusted-uris')) -ne -1)
{
  If ($line.IndexOf('*') -ne -1) {
    $line = $line.replace( '*' , 'abc.com,.abcd.com,.abcde.com')
  }
}
$line

}

$data | Set-Content $FullFileName -Force

I tried to script a PS to make changes to the Pref.js file; however, the changes do not stick? Is this is expected or done by default is there a way that I can modify the file without going to which single system? PS Script $TopDir = "$env:APPDATA\Mozilla\Firefox\Profiles" $FileName = 'prefs.js' $DefaultProfileDir = (Get-ChildItem -LiteralPath $TopDir -Directory). Where({ $_.FullName -match '\.default' }).FullName $FullFileName = Join-Path -Path $DefaultProfileDir -ChildPath $FileName $Data = foreach($line in Get-Content $FullFileName) { if( ($line.IndexOf('network.automatic-ntlm-auth.trusted-uris')) -ne -1) { If ($line.IndexOf('*') -ne -1) { $line = $line.replace( '*' , 'abc.com,.abcd.com,.abcde.com') } } $line } $data | Set-Content $FullFileName -Force

Выбранное решение

Все ответы (2)

more options

Выбранное решение

No need to edit prefs.js as you can do this via a policy.

See Authentication

more options

Also, while Firefox is open, any changes to prefs.js are likely to be ignored or overwritten. You would need to make changes while Firefox is not running if you wanted to do it this way.