Problem scenario
You want to install Firefox on a Windows server without using the traditional GUI method. What should you do?
Solution
Updated on 5/16/21
1. Open PowerShell ISE as Administrator (right click it, go to More -Run as Administrator).
2. Run this script (e.g., firefox.ps1):
# This script was mostly taken from https://forum.pulseway.com/topic/1940-install-firefox-with-powershell/
# www.continualintegration.com changed the version number of Firefox and added some comments
# Silent Install Firefox
# Download URL: https://www.mozilla.org/en-US/firefox/all/
# Path for the workdir
$workdir = “c:\installer\”
# Check if work directory exists if not create it
If (Test-Path -Path $workdir -PathType Container)
{ Write-Host “$workdir already exists” -ForegroundColor Red}
ELSE
{ New-Item -Path $workdir -ItemType directory }
# Download the installer
$source = “https://download.mozilla.org/?product=firefox-88.0.1-SSL&os=win64&lang=en-US”
$destination = “$workdir\firefox.exe”
# Check if Invoke-Webrequest exists otherwise execute WebClient
if (Get-Command ‘Invoke-Webrequest’)
{
Invoke-WebRequest $source -OutFile $destination
}
else
{
$WebClient = New-Object System.Net.WebClient
$webclient.DownloadFile($source, …
Continue reading “How Do You Install Firefox on a Windows Server with PowerShell?”