mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-02-16 17:51:28 +01:00
Update list-updates.ps1 and install-updates.ps1
This commit is contained in:
parent
48caeda15f
commit
77f9dafecf
@ -1,9 +1,9 @@
|
|||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Installs updates
|
Installs software updates
|
||||||
.DESCRIPTION
|
.DESCRIPTION
|
||||||
This PowerShell script installs software updates for the local machine (needs admin rights).
|
This PowerShell script installs software updates for the local machine (needs admin rights).
|
||||||
Use the script 'list-updates.ps1' to list available updates.
|
NOTE: Use the script 'list-updates.ps1' to list the latest software updates.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./install-updates.ps1
|
PS> ./install-updates.ps1
|
||||||
.LINK
|
.LINK
|
||||||
@ -32,12 +32,12 @@ try {
|
|||||||
& sudo softwareupdate -i -a
|
& sudo softwareupdate -i -a
|
||||||
Write-Progress -completed " "
|
Write-Progress -completed " "
|
||||||
} else {
|
} else {
|
||||||
Write-Progress "⏳ Installing updates..."
|
Write-Progress "⏳ Installing updates from winget and Microsoft Store..."
|
||||||
& winget upgrade --all
|
& winget upgrade --all --include-unknown
|
||||||
Write-Progress -completed " "
|
Write-Progress -completed " "
|
||||||
}
|
}
|
||||||
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
|
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
|
||||||
"✅ Updates installed in $Elapsed sec"
|
"✅ Installed updates in $Elapsed sec"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Lists new software updates
|
Lists software updates
|
||||||
.DESCRIPTION
|
.DESCRIPTION
|
||||||
This PowerShell script queries and lists available software updates for the local machine.
|
This PowerShell script queries the latest available software updates for the local machine and lists it.
|
||||||
Use 'install-updates.ps1' to install the listed updates.
|
NOTE: Use the script 'install-updates.ps1' to install the listed updates.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./list-updates.ps1
|
PS> ./list-updates.ps1
|
||||||
|
|
||||||
@ -25,12 +25,12 @@ try {
|
|||||||
"⏳ (2/2) Querying Snap updates..."
|
"⏳ (2/2) Querying Snap updates..."
|
||||||
& sudo snap refresh --list
|
& sudo snap refresh --list
|
||||||
} else {
|
} else {
|
||||||
|
Write-Progress "⏳ Querying the latest updates from winget and Microsoft Store..."
|
||||||
" "
|
" "
|
||||||
Write-Progress "⏳ Querying new software updates..."
|
& winget upgrade --include-unknown
|
||||||
& winget upgrade
|
Write-Progress -completed " "
|
||||||
Write-Progress -completed "."
|
|
||||||
}
|
}
|
||||||
"(use 'install-updates.ps1' to install the listed updates)"
|
" (use 'install-updates.ps1' to install the listed updates)"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
Loading…
Reference in New Issue
Block a user