mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-12-16 19:50:45 +01:00
Update install-updates.ps1
This commit is contained in:
parent
e2a98f1e50
commit
8af0a9390b
@ -1,6 +1,6 @@
|
|||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Installs updates for the local machine (needs admin rights)
|
Installs software updates
|
||||||
.DESCRIPTION
|
.DESCRIPTION
|
||||||
This PowerShell script installs updates for the local machine (needs admin rights).
|
This PowerShell script installs updates for the local machine (needs admin rights).
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
@ -11,30 +11,28 @@
|
|||||||
Author: Markus Fleschutz | License: CC0
|
Author: Markus Fleschutz | License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$StopWatch = [system.diagnostics.stopwatch]::startNew()
|
$StopWatch = [system.diagnostics.stopwatch]::startNew()
|
||||||
|
|
||||||
if ($IsLinux) {
|
if ($IsLinux) {
|
||||||
"⏳ Step 1/4 - Fetching update infos for installed Debian packages..."
|
"⏳ (1/4) Fetching update infos for installed Debian packages..."
|
||||||
& sudo apt update
|
& sudo apt update
|
||||||
|
|
||||||
"⏳ Step 2/4 - Upgrading installed Debian packages..."
|
"⏳ (2/4) Upgrading installed Debian packages..."
|
||||||
& sudo apt upgrade --yes
|
& sudo apt upgrade --yes
|
||||||
|
|
||||||
"⏳ Step 3/4 - Removing obsolete Debian packages..."
|
"⏳ (3/4) Removing obsolete Debian packages..."
|
||||||
& sudo apt autoremove --yes
|
& sudo apt autoremove --yes
|
||||||
|
|
||||||
"⏳ Step 4/4 - Upgrading installed Snap packages..."
|
"⏳ (4/4) Upgrading installed Snap packages..."
|
||||||
& sudo snap refresh
|
& sudo snap refresh
|
||||||
} else {
|
} else {
|
||||||
"⏳ Step 1/2 - Fetching update infos..."
|
"⏳ (1/2) Fetching update infos..."
|
||||||
& winget upgrade
|
& winget upgrade
|
||||||
|
|
||||||
"⏳ Step 2/2 - Upgrading apps..."
|
"⏳ (2/2) Upgrading apps..."
|
||||||
& winget upgrade --all
|
& winget upgrade --all
|
||||||
}
|
}
|
||||||
|
|
||||||
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
|
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
|
||||||
"✔️ installed updates in $Elapsed sec"
|
"✔️ installed updates in $Elapsed sec"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
|
Loading…
Reference in New Issue
Block a user