Update check-pending-reboot.ps1 and install-updates.ps1

This commit is contained in:
Markus Fleschutz 2024-04-19 16:32:40 +02:00
parent 3dba184d19
commit 00d0fb333e
2 changed files with 6 additions and 4 deletions

View File

@ -5,7 +5,7 @@
This PowerShell script queries pending operating system reboots and prints it. This PowerShell script queries pending operating system reboots and prints it.
.EXAMPLE .EXAMPLE
./check-pending-reboot.ps1 ./check-pending-reboot.ps1
No pending system reboot No pending reboot
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
@ -60,11 +60,11 @@ try {
$Reason += ", '...\CurrentControlSet\Services\Netlogon' with 'AvoidSpnSet'" $Reason += ", '...\CurrentControlSet\Services\Netlogon' with 'AvoidSpnSet'"
} }
if ($Reason -ne "") { if ($Reason -ne "") {
Write-Host "⚠️ Pending reboot (registry contains $($Reason.substring(2)))" Write-Host "⚠️ Pending reboot (registry got $($Reason.substring(2)))"
} }
} }
if ($Reason -eq "") { if ($Reason -eq "") {
Write-Host "✅ No pending system reboot" Write-Host "✅ No pending reboot"
} }
exit 0 # success exit 0 # success
} catch { } catch {

View File

@ -24,6 +24,7 @@ try {
if ($IsLinux) { if ($IsLinux) {
"⏳ (1/5) Checking requirements..." "⏳ (1/5) Checking requirements..."
& "$PSScriptRoot/check-smart-devices.ps1"
& "$PSScriptRoot/check-drive-space.ps1" / & "$PSScriptRoot/check-drive-space.ps1" /
& "$PSScriptRoot/check-swap-space.ps1" & "$PSScriptRoot/check-swap-space.ps1"
& "$PSScriptRoot/check-pending-reboot.ps1" & "$PSScriptRoot/check-pending-reboot.ps1"
@ -47,6 +48,7 @@ try {
} else { } else {
# Windows: # Windows:
"⏳ (1/2) Checking requirements..." "⏳ (1/2) Checking requirements..."
& "$PSScriptRoot/check-smart-devices.ps1"
& "$PSScriptRoot/check-drive-space.ps1" C & "$PSScriptRoot/check-drive-space.ps1" C
& "$PSScriptRoot/check-swap-space.ps1" & "$PSScriptRoot/check-swap-space.ps1"
& "$PSScriptRoot/check-pending-reboot.ps1" & "$PSScriptRoot/check-pending-reboot.ps1"
@ -57,7 +59,7 @@ try {
& winget upgrade --all --include-unknown & winget upgrade --all --include-unknown
} }
[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
} catch { } catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"