Mozilla Firefox - Extension - Install
Summary
Installs an extension on the Mozilla Firefox Browser.
Sample Run
 
 

Dependencies
User Parameters
| Name | Example | Required | Description | 
|---|---|---|---|
| ExtensionName | 'Unblock-Origin' | True | The name of the extension to install. | 
| Mandate | False | Removes the user's right to remove the extension. | 
Task Creation
Create a new Script Editor style script in the system to implement this task.

Name: Mozilla Firefox - Extension - Install
Description: Installs an extension on the Mozilla Firefox Browser.
Category: Application
Parameters
Add a new parameter by clicking the Add Parameter button present at the top-right corner of the screen.
This screen will appear.

- Set ExtensionNamein theParameter Namefield.
- Enable the Required Fieldoption.
- Select Text Stringfrom theParameter Typedropdown menu.
- Click the Savebutton.
  
- It will ask for confirmation to proceed. Click the Confirmbutton to create the parameter.
  
Add another parameter by clicking the Add Parameter button present at the top-right corner of the screen.
This screen will appear.

- Set Mandatein theParameter Namefield.
- Select Flagfrom theParameter Typedropdown menu.
- Click the Savebutton.
  
- It will ask for confirmation to proceed. Click the Confirmbutton to create the parameter.
  

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.
A blank function will appear.
Row 1 Function: PowerShell Script
Search and select the PowerShell Script function.
The following function will pop up on the screen:
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 = 'Register-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

Click the Save button at the top-right corner of the screen to save the script.
Completed Task
Output
- Script Log