Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $HomeDrive = [environment]::GetEnvironmentVariable("HOMEDRIVE")
- $Homepath = [environment]::GetEnvironmentVariable("HOMEPATH")
- $ProfilePath = $Homedrive + $Homepath + "\AppData\Roaming\Mozilla\Firefox\Profiles\"
- If ((test-path $ProfilePath) -eq $false) {[Environment]::Exit(0)}
- $ProfileDir = (Get-Childitem $ProfilePath)
- $Profiles = ($Profilepath + $ProfileDir)
- Foreach ($Profile in $Profiledir){
- $Certdb = $Profilepath + $Profile.name
- If((test-path $CertDB) -eq $true) {
- & ".\certutil.exe" -A -n "okta" -i "okta-iwa-pr-1.cer" -d $Certdb -t "TC,TC,TC"
- }
- }
- Import-Module .\FirefoxPref.psd1 -ErrorAction SilentlyContinue
- if (-not (get-module -name FirefoxPref)) {
- Import-Module .\FirefoxPref.psm1 -ErrorAction SilentlyContinue
- }
- Set-FirefoxPref -file firefox.js -setting network.automatic-ntlm-auth.allow-non-fqdn -value $true
- Set-FirefoxPref -file firefox.js -setting network.negotiate-auth.allow-non-fqdn -value $true
- Set-FirefoxPref -file firefox.js -setting network.automatic-ntlm-auth.trusted-uris -value '"okta-iwa-pr-1.asshole.internal,okta-iwa-pr-1"'
- Set-FirefoxPref -scope user -file prefs.js -setting extensions.autoDisableScopes -value 0
- Set-FirefoxPref -scope user -file prefs.js -setting extensions.enabledScopes -value 15
- # find Firefox install directory -- try 64-bit path first
- $FFinstallDir = "${Env:ProgramFiles(x86)}\Mozilla Firefox"
- $FFextensionsRegKey = "HKLM:\SOFTWARE\Wow6432Node\Mozilla\Firefox\Extensions"
- if (!(Test-Path -Path $FFinstalldir)) {
- # if 64-bit path fails, fall back to 32-bit path
- $FFinstallDir = "${Env:ProgramFiles}\Mozilla Firefox"
- $FFextensionsRegKey = "HKLM:\SOFTWARE\Mozilla\Firefox\Extensions"
- }
- if (!(Test-Path -Path $FFinstallDir)) {
- Write-Host "Problem: Could not find Firefox installation folder."
- Exit 16003 # 3 = "path not found"
- }
- # create extensions folder if necessary
- $FFextensionsDir = "$FFinstallDir\extensions"
- if (!(Test-Path -Path $FFextensionsDir)) {
- New-Item $FFextensionsDir -ItemType Directory -ErrorAction SilentlyContinue -Force | Out-Null
- }
- # create extensions registry key if necessary
- if (!(Test-Path -Path $FFextensionsRegKey)) {
- New-Item $FFextensionsRegKey -ErrorAction SilentlyContinue -Force | Out-Null
- }
- # install extensions (asssumes extensions are all sub-folders in this script's path)
- Get-ChildItem . -Directory | ForEach-Object {
- write-host Installing Firefox extension: $_.Name
- # copy each extension folder to the system
- Copy-Item $_.FullName $FFextensionsDir -Recurse -Force | Out-Null
- # create registry key for each extension
- New-ItemProperty -Path $FFextensionsRegKey -Name $_.Name -Value "$FFextensionsDir\$($_.Name)" -PropertyType String -Force | Out-Null
- }
Advertisement
Add Comment
Please, Sign In to add comment