mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-11-25 09:23:12 +01:00
Update install-vlc.ps1 and uninstall-vlc.ps1
This commit is contained in:
parent
16bb5e7fdb
commit
2bf289b8ea
@ -5,6 +5,8 @@
|
||||
This PowerShell script installs the VLC media player.
|
||||
.EXAMPLE
|
||||
PS> ./install-vlc.ps1
|
||||
⏳ Installing VLC media player...
|
||||
✔️ Installation of VLC media player took 25 sec
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -12,12 +14,14 @@
|
||||
#>
|
||||
|
||||
try {
|
||||
"Installing VLC media player, please wait..."
|
||||
"⏳ Installing VLC media player..."
|
||||
$StopWatch = [system.diagnostics.stopwatch]::startNew()
|
||||
|
||||
& winget install --id VideoLAN.VLC --accept-package-agreements --accept-source-agreements
|
||||
if ($lastExitCode -ne "0") { throw "'winget install' failed" }
|
||||
& winget install --id XPDM1ZW6815MQM --accept-package-agreements --accept-source-agreements
|
||||
if ($lastExitCode -ne "0") { throw "Can't install VLC media player, is it already installed?" }
|
||||
|
||||
"VLC media player installed successfully."
|
||||
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
|
||||
"✔️ Installation of VLC media player took $Elapsed sec"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
|
@ -4,7 +4,9 @@
|
||||
.DESCRIPTION
|
||||
This PowerShell script uninstalls the VLC media player from the local computer.
|
||||
.EXAMPLE
|
||||
PS> ./uninstall-vlc
|
||||
PS> ./uninstall-vlc.ps1
|
||||
⏳ Uninstalling VLC media player...
|
||||
✔️ Removal of VLC media player took 7 sec
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -12,12 +14,14 @@
|
||||
#>
|
||||
|
||||
try {
|
||||
"Uninstalling VLC media player, please wait..."
|
||||
"⏳ Uninstalling VLC media player..."
|
||||
$StopWatch = [system.diagnostics.stopwatch]::startNew()
|
||||
|
||||
& winget uninstall "VLC"
|
||||
& winget uninstall --id XPDM1ZW6815MQM
|
||||
if ($lastExitCode -ne "0") { throw "Can't uninstall VLC media player, is it installed?" }
|
||||
|
||||
"VLC media player is uninstalled now."
|
||||
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
|
||||
"✔️ Removal of VLC media player took $Elapsed sec"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"Sorry: $($Error[0])"
|
||||
|
Loading…
Reference in New Issue
Block a user