Worklet: Install Mozilla Firefox on Windows

  • 5 March 2021
  • 0 replies
  • 198 views

Userlevel 4

Hi all,


Just posting my method of installing Firefox (I know you can use a Required Software policy but that wasn’t going to work for us)


Simply if you download the Firefox MSI via https://www.mozilla.org/en-GB/firefox/all/#product-desktop-release and then upload it, once uploaded, make sure the file name matches in the remediation script. This then checks whether a temp folder on c:\ exists, if so, skips, if not, creates, then checks if Mozilla Firefox exists in Program Files, if not, it installs it.


Evaluation


if (Test-Path -Path "C:\Program Files\Mozilla Firefox") 
{
exit 0
}
else
{
Exit 1
}

Remediation


$path = "C:\temp\"

if(!(Test-Path -path $path))
{
New-Item -ItemType directory -Path $path -Verbose
Write-Output "The folder path has been created successfully at $path"
}
else
{
Write-Output "The folder $path already exists"
}

Start-Transcript -Verbose -Path "c:\temp\firefox.log"

Copy-Item "firefox_setup_86.msi" -Destination "C:\temp\firefox_setup_86.msi" -Verbose

$firefoxpath = "C:\Program Files\Mozilla Firefox"

# Check if Firefox is installed
if (Test-Path $firefoxpath -Verbose) {
Write-Output "Firefox is already installed. Skipping..."
Write-Output "Exit Code: $LASTEXITCODE"
exit
}
else {
Write-Output "Firefox not installed, installing..."
Start-Process -FilePath 'msiexec.exe' -ArgumentList '/qn', '/i', 'C:\temp\firefox_setup_86.msi' -Verbose
Write-Output "Firefox has been installed."
}

Stop-Transcript

Enjoy


0 replies

Be the first to reply!

Reply