mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-05-13 12:05:06 +02:00
Improved check-power.ps1 and install-updates.ps1
This commit is contained in:
parent
5390e1fa70
commit
a0f0ed7814
@ -29,7 +29,7 @@ try {
|
|||||||
} elseif ($percent -ge 95) {
|
} elseif ($percent -ge 95) {
|
||||||
$reply = "✅ Battery full ($percent%, power scheme is '$powerScheme')"
|
$reply = "✅ Battery full ($percent%, power scheme is '$powerScheme')"
|
||||||
} else {
|
} else {
|
||||||
$reply = "✅ Battery charging ($percent%, power scheme is '$powerScheme')"
|
$reply = "✅ Battery $percent% and charging (power scheme is '$powerScheme')"
|
||||||
}
|
}
|
||||||
} else { # must be offline
|
} else { # must be offline
|
||||||
if (($remaining -eq 0) -and ($percent -ge 60)) {
|
if (($remaining -eq 0) -and ($percent -ge 60)) {
|
||||||
|
@ -55,10 +55,20 @@ try {
|
|||||||
& "$PSScriptRoot/check-pending-reboot.ps1"
|
& "$PSScriptRoot/check-pending-reboot.ps1"
|
||||||
Start-Sleep -seconds 3
|
Start-Sleep -seconds 3
|
||||||
""
|
""
|
||||||
"⏳ (2/2) Installing updates from winget..."
|
"⏳ (2/4) Updating Windows Store apps..."
|
||||||
|
if (Get-Command winget -ErrorAction SilentlyContinue) {
|
||||||
|
& winget upgrade --all --source=msstore --include-unknown
|
||||||
|
}
|
||||||
""
|
""
|
||||||
& winget upgrade --all --source=winget
|
"⏳ (3/4) Updating Chocolatey packages..."
|
||||||
# & winget upgrade --all --source=msstore # does not work
|
if (Get-Command choco -ErrorAction SilentlyContinue) {
|
||||||
|
& choco upgrade all -y
|
||||||
|
}
|
||||||
|
""
|
||||||
|
"⏳ (4/4) Updating Winget packages..."
|
||||||
|
if (Get-Command winget -ErrorAction SilentlyContinue) {
|
||||||
|
& winget upgrade --all --source=winget --include-unknown
|
||||||
|
}
|
||||||
}
|
}
|
||||||
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
|
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
|
||||||
"✅ Updates installed in $($elapsed)s."
|
"✅ Updates installed in $($elapsed)s."
|
||||||
|
Loading…
Reference in New Issue
Block a user