File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55 This PowerShell script installs the VLC media player.
66. EXAMPLE
77 PS> ./install-vlc.ps1
8+ ⏳ Installing VLC media player...
9+ ✔️ Installation of VLC media player took 25 sec
810. LINK
911 https://github.com/fleschutz/PowerShell
1012. NOTES
1113 Author: Markus Fleschutz | License: CC0
1214#>
1315
1416try {
15- " Installing VLC media player, please wait..."
17+ " ⏳ Installing VLC media player..."
18+ $StopWatch = [system.diagnostics.stopwatch ]::startNew()
1619
17- & winget install -- id VideoLAN.VLC -- accept- package- agreements -- accept- source- agreements
18- if ($lastExitCode -ne " 0" ) { throw " 'winget install' failed " }
20+ & winget install -- id XPDM1ZW6815MQM -- accept- package- agreements -- accept- source- agreements
21+ if ($lastExitCode -ne " 0" ) { throw " Can't install VLC media player, is it already installed? " }
1922
20- " VLC media player installed successfully."
23+ [int ]$Elapsed = $StopWatch.Elapsed.TotalSeconds
24+ " ✔️ Installation of VLC media player took $Elapsed sec"
2125 exit 0 # success
2226} catch {
2327 " ⚠️ Error in line $ ( $_.InvocationInfo.ScriptLineNumber ) : $ ( $Error [0 ]) "
Original file line number Diff line number Diff line change 44. DESCRIPTION
55 This PowerShell script uninstalls the VLC media player from the local computer.
66. EXAMPLE
7- PS> ./uninstall-vlc
7+ PS> ./uninstall-vlc.ps1
8+ ⏳ Uninstalling VLC media player...
9+ ✔️ Removal of VLC media player took 7 sec
810. LINK
911 https://github.com/fleschutz/PowerShell
1012. NOTES
1113 Author: Markus Fleschutz | License: CC0
1214#>
1315
1416try {
15- " Uninstalling VLC media player, please wait..."
17+ " ⏳ Uninstalling VLC media player..."
18+ $StopWatch = [system.diagnostics.stopwatch ]::startNew()
1619
17- & winget uninstall " VLC "
20+ & winget uninstall -- id XPDM1ZW6815MQM
1821 if ($lastExitCode -ne " 0" ) { throw " Can't uninstall VLC media player, is it installed?" }
1922
20- " VLC media player is uninstalled now."
23+ [int ]$Elapsed = $StopWatch.Elapsed.TotalSeconds
24+ " ✔️ Removal of VLC media player took $Elapsed sec"
2125 exit 0 # success
2226} catch {
2327 " Sorry: $ ( $Error [0 ]) "
You can’t perform that action at this time.
0 commit comments