Skip to main content

Mozilla Firefox - Extension - Remove

Summary

This document describes how to remove an extension from the Mozilla Firefox browser.

Sample Run

Sample Run 1
Sample Run 2
Sample Run 3

Dependencies

Unregister-FirefoxExtension

User Parameters

NameExampleRequiredDescription
ExtensionName'Unblock-Origin'TrueThe name of the extension to remove.
MandateFalseUse this switch to prevent future installation of the target addon in Firefox.

Task Creation

Create a new Script Editor style script in the system to implement this task.
Task Creation 1
Task Creation 2

Name: Mozilla Firefox - Extension - Remove
Description: Removes an extension from the Mozilla Firefox browser.
Category: Application
Task Creation 3

Parameters

Add a new parameter by clicking the Add Parameter button present at the top-right corner of the screen.
Add Parameter

This screen will appear.
Parameter Screen

  • Set ExtensionName in the Parameter Name field.
  • Enable the Required Field option.
  • Select Text String from the Parameter Type dropdown menu.
  • Click the Save button.
    Save Button
  • It will ask for confirmation to proceed. Click the Confirm button to create the parameter.
    Confirm Button

Add another parameter by clicking the Add Parameter button present at the top-right corner of the screen.
Add Parameter Again

This screen will appear.
Parameter Screen Again

  • Set Mandate in the Parameter Name field.
  • Select Flag from the Parameter Type dropdown menu.
  • Click the Save button.
    Save Button Again
  • It will ask for confirmation to proceed. Click the Confirm button to create the parameter.
    Confirm Button Again
    Final Parameter Screen

Task

Navigate to the Script Editor section and start by adding a row. You can do this by clicking the Add Row button at the bottom of the script page.
Add Row

A blank function will appear.
Blank Function

Row 1 Function: PowerShell Script

Search and select the PowerShell Script function.
PowerShell Script Selection 1
PowerShell Script Selection 2

The following function will pop up on the screen:
PowerShell Script Function

Paste in the following PowerShell script and set the expected time of script execution to 900 seconds. Click the Save button.

$ExtensionName = "@ExtensionName@"
$Mandate = '@Mandate@'
$ProjectName = 'Unregister-FirefoxExtension'
$WorkingDirectory = "C:\ProgramData\_Automation\Script\$ProjectName"
$ScriptPath = "$WorkingDirectory\$ProjectName.ps1"
$BaseURL = 'https://file.provaltech.com/repo'
$PS1URL = "$BaseURL/Script/$ProjectName.ps1"
$LogPath = "$WorkingDirectory\$ProjectName-log.txt"
$ErrorLogPath = "$WorkingDirectory\$ProjectName-Error.txt"
[Net.ServicePointManager]::SecurityProtocol = [Enum]::ToObject([Net.SecurityProtocolType], 3072)
Remove-Item $WorkingDirectory -Force -Recurse -ErrorAction SilentlyContinue | Out-Null
Mkdir $WorkingDirectory 3>&1 2>&1 1>$Null
try {(New-Object System.Net.WebClient).DownloadFile($PS1URL, $ScriptPath)} catch {throw 'Script Download Failure'}
if ( $Mandate -match '1|True|Yes' ) {
& $ScriptPath -ExtensionName $ExtensionName -Mandate
} else {
& $ScriptPath -ExtensionName $ExtensionName
}
if ( !(Test-Path $LogPath) ) {
Throw 'PowerShell Failure. A Security application seems to have restricted the execution of the PowerShell Script.'
}
if ( Test-Path $ErrorLogPath ) {
$ErrorContent = ( Get-Content -Path $ErrorLogPath )
throw $ErrorContent
}
Get-Content -Path $LogPath

PowerShell Script Save

Click the Save button at the top-right corner of the screen to save the script.
Final Save

Completed Task

Completed Task

Output

  • Script Log