mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-11-29 03:13:55 +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.
|
This PowerShell script installs the VLC media player.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./install-vlc.ps1
|
PS> ./install-vlc.ps1
|
||||||
|
⏳ Installing VLC media player...
|
||||||
|
✔️ Installation of VLC media player took 25 sec
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -12,12 +14,14 @@
|
|||||||
#>
|
#>
|
||||||
|
|
||||||
try {
|
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
|
& winget install --id XPDM1ZW6815MQM --accept-package-agreements --accept-source-agreements
|
||||||
if ($lastExitCode -ne "0") { throw "'winget install' failed" }
|
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
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
@ -4,7 +4,9 @@
|
|||||||
.DESCRIPTION
|
.DESCRIPTION
|
||||||
This PowerShell script uninstalls the VLC media player from the local computer.
|
This PowerShell script uninstalls the VLC media player from the local computer.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./uninstall-vlc
|
PS> ./uninstall-vlc.ps1
|
||||||
|
⏳ Uninstalling VLC media player...
|
||||||
|
✔️ Removal of VLC media player took 7 sec
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -12,12 +14,14 @@
|
|||||||
#>
|
#>
|
||||||
|
|
||||||
try {
|
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?" }
|
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
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"Sorry: $($Error[0])"
|
"Sorry: $($Error[0])"
|
||||||
|
Loading…
Reference in New Issue
Block a user