mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-06-30 12:41:46 +02:00
Add install-updates.ps1
This commit is contained in:
31
Scripts/install-updates.ps1
Executable file
31
Scripts/install-updates.ps1
Executable file
@ -0,0 +1,31 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
install-updates.ps1
|
||||
.DESCRIPTION
|
||||
Installs updates (needs admin rights)
|
||||
.EXAMPLE
|
||||
PS> .\install-updates.ps1
|
||||
.NOTES
|
||||
Author: Markus Fleschutz · License: CC0
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
#>
|
||||
|
||||
#Requires -RunAsAdministrator
|
||||
|
||||
try {
|
||||
$StopWatch = [system.diagnostics.stopwatch]::startNew()
|
||||
|
||||
if ($IsLinux) {
|
||||
apt update && apt upgrade && apt autoremove && snap refresh
|
||||
} else {
|
||||
"Sorry, not supported yet"
|
||||
}
|
||||
|
||||
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
|
||||
"✔️ installed updates in $Elapsed sec"
|
||||
exit 0
|
||||
} catch {
|
||||
"⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))"
|
||||
exit 1
|
||||
}
|
Reference in New Issue
Block a user