Advertisement
pedronrivera

Remove Fire Fox Web Browser v2

Mar 15th, 2018
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #Uninstall Firefox installed user Rights
  2. $FireFoxSTDEXE = "C:\Users\privera\AppData\Local\Mozilla Firefox\firefox.exe"
  3. $FileExistsSTD = Test-Path $FireFoxSTDEXE
  4.  
  5. If ($FileExistsSTD -eq $True) {
  6.    
  7.     #This part of the script will go through all user folders and remove FireFox if found"
  8.     Write-Host "FireFox User Install Found, removig FireFox now." -ForegroundColor Red
  9.     get-childitem "C:\users" firefox.exe -Recurse -Force | foreach-object {
  10.         $setup = $_.directory.tostring() + "\uninstall\helper.exe"
  11.         $args = " /s"
  12.         $uninst = Start-Process $setup -PassThru -ArgumentList $args -wait
  13.         $uninst.WaitForExit()
  14.  
  15.     #Delete FireFox Desktop Icon
  16.     $FireFoxIcon = "$env:userprofile\Desktop\Firefox.lnk"
  17.     $FireFoxIconExists = Test-Path $FireFoxIcon
  18.  
  19.     If ($FireFoxIconExists -eq $True) {
  20.        
  21.         Remove-Item $FireFoxIcon
  22.        
  23.         }
  24.  
  25.     }
  26.  
  27. } Else {Write-Host "FireFox User Install Not Found" -ForegroundColor Green }
  28.  
  29. <#
  30. Delete registry key
  31. $null = New-PSDrive -Name HKU -PSProvider Registry -Root Registry::HKEY_USERS
  32. Set-Location HKU:
  33. Get-ChildItem -path HKU: | ForEach-Object {
  34. $uninstall = $_.Name + "\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*"
  35. $firefox = get-ChildItem -path $uninstall | ?{$_.Name -match "Mozilla Firefox"}
  36. write-host $firefox
  37. Remove-Item -path $firefox -Recurse -ErrorAction SilentlyContinue
  38. }
  39. #>
  40.  
  41. #Uninstall FireFox installed with Admin Rights
  42. $FireFoxADMEXE = "C:\Program Files\Mozilla Firefox\firefox.exe"
  43. $FileExistsADM = Test-Path $FireFoxADMEXE
  44. $RemoveFireFox="C:\Program Files\Mozilla Firefox\uninstall\helper.exe"
  45.  
  46. If ($FileExistsADM -eq $True) {
  47.    
  48.     Write-Host "FireFox Admin Install Found, , removig FireFox now" -ForegroundColor Red
  49.     Start-Process -FilePath "$RemoveFireFox" -ArgumentList "/S"
  50.  
  51. } Else {Write-Host "FireFox Admin Install Not Found" -ForegroundColor Green }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement