badteeth3000

firefox ps

Apr 26th, 2015
375
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. $HomeDrive = [environment]::GetEnvironmentVariable("HOMEDRIVE")
  3. $Homepath = [environment]::GetEnvironmentVariable("HOMEPATH")
  4. $ProfilePath = $Homedrive + $Homepath + "\AppData\Roaming\Mozilla\Firefox\Profiles\"
  5. If ((test-path $ProfilePath) -eq $false) {[Environment]::Exit(0)}
  6. $ProfileDir = (Get-Childitem $ProfilePath)
  7. $Profiles = ($Profilepath + $ProfileDir)
  8. Foreach ($Profile in $Profiledir){
  9. $Certdb =  $Profilepath + $Profile.name
  10. If((test-path $CertDB) -eq $true) {
  11. & ".\certutil.exe" -A -n "okta" -i "okta-iwa-pr-1.cer" -d $Certdb -t "TC,TC,TC"
  12. }
  13. }
  14.  
  15. Import-Module .\FirefoxPref.psd1 -ErrorAction SilentlyContinue
  16. if (-not (get-module -name FirefoxPref)) {
  17.     Import-Module .\FirefoxPref.psm1 -ErrorAction SilentlyContinue
  18. }
  19. Set-FirefoxPref -file firefox.js -setting network.automatic-ntlm-auth.allow-non-fqdn -value $true
  20. Set-FirefoxPref -file firefox.js -setting network.negotiate-auth.allow-non-fqdn -value $true
  21. Set-FirefoxPref -file firefox.js -setting network.automatic-ntlm-auth.trusted-uris -value '"okta-iwa-pr-1.asshole.internal,okta-iwa-pr-1"'
  22. Set-FirefoxPref -scope user -file prefs.js -setting extensions.autoDisableScopes -value 0
  23. Set-FirefoxPref -scope user -file prefs.js -setting extensions.enabledScopes -value 15
  24.  
  25.  
  26. # find Firefox install directory -- try 64-bit path first
  27. $FFinstallDir = "${Env:ProgramFiles(x86)}\Mozilla Firefox"
  28. $FFextensionsRegKey = "HKLM:\SOFTWARE\Wow6432Node\Mozilla\Firefox\Extensions"
  29. if (!(Test-Path -Path $FFinstalldir)) {
  30.     # if 64-bit path fails, fall back to 32-bit path
  31.     $FFinstallDir    = "${Env:ProgramFiles}\Mozilla Firefox"
  32.     $FFextensionsRegKey = "HKLM:\SOFTWARE\Mozilla\Firefox\Extensions"
  33. }
  34. if (!(Test-Path -Path $FFinstallDir)) {
  35.     Write-Host "Problem: Could not find Firefox installation folder."
  36.     Exit 16003  # 3 = "path not found"
  37. }
  38.  
  39. # create extensions folder if necessary
  40. $FFextensionsDir = "$FFinstallDir\extensions"
  41. if (!(Test-Path -Path $FFextensionsDir)) {
  42.     New-Item $FFextensionsDir -ItemType Directory -ErrorAction SilentlyContinue -Force | Out-Null
  43. }
  44. # create extensions registry key if necessary
  45. if (!(Test-Path -Path $FFextensionsRegKey)) {
  46.     New-Item $FFextensionsRegKey -ErrorAction SilentlyContinue -Force | Out-Null
  47. }
  48.  
  49. # install extensions (asssumes extensions are all sub-folders in this script's path)
  50. Get-ChildItem . -Directory | ForEach-Object {
  51.     write-host Installing Firefox extension: $_.Name
  52.     # copy each extension folder to the system
  53.     Copy-Item $_.FullName $FFextensionsDir -Recurse -Force | Out-Null
  54.     # create registry key for each extension
  55.     New-ItemProperty -Path $FFextensionsRegKey -Name $_.Name -Value "$FFextensionsDir\$($_.Name)" -PropertyType String -Force | Out-Null
  56. }
Advertisement
Add Comment
Please, Sign In to add comment