-
-
Notifications
You must be signed in to change notification settings - Fork 546
Expand file tree
/
Copy pathinstall-firefox.ps1
More file actions
executable file
·31 lines (27 loc) · 970 Bytes
/
install-firefox.ps1
File metadata and controls
executable file
·31 lines (27 loc) · 970 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<#
.SYNOPSIS
Installs Mozilla Firefox
.DESCRIPTION
This PowerShell script installs the Mozilla Firefox browser from Microsoft Store.
.EXAMPLE
PS> ./install-firefox.ps1
⏳ Installing Mozilla Firefox from Microsoft Store...
✅ Mozilla Firefox installed successfully in 25s.
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
#requires -version 5.1
try {
"⏳ Installing Mozilla Firefox from Microsoft Store..."
$stopWatch = [system.diagnostics.stopwatch]::startNew()
& winget install --id 9NZVDKPMR9RD --source msstore --accept-package-agreements --accept-source-agreements
if ($lastExitCode -ne 0) { throw "Can't install Mozilla Firefox - maybe it's already installed" }
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
"✅ Mozilla Firefox installed successfully in $($elapsed)s."
exit 0 # success
} catch {
"⚠️ ERROR: $($Error[0]) (in script line $($_.InvocationInfo.ScriptLineNumber))"
exit 1
}