Updated check-drive-space.ps1 and install-updates.ps1

This commit is contained in:
Markus Fleschutz 2024-01-29 20:57:10 +01:00
parent 8aac02ceab
commit 8fcdf14d13
2 changed files with 6 additions and 5 deletions

View File

@ -9,7 +9,7 @@
Specifies the minimum level in bytes (10GB by default) Specifies the minimum level in bytes (10GB by default)
.EXAMPLE .EXAMPLE
PS> ./check-drive-space.ps1 C PS> ./check-drive-space.ps1 C
Drive C: uses 56%, 442GB free of 999GB Drive C: uses 56% of 1TB · 442GB free
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
@ -49,7 +49,7 @@ try {
Write-Host "⚠️ Drive $driveName with $(Bytes2String $total) is nearly full, $(Bytes2String $free) free" Write-Host "⚠️ Drive $driveName with $(Bytes2String $total) is nearly full, $(Bytes2String $free) free"
} else { } else {
[int]$percent = ($used * 100) / $total [int]$percent = ($used * 100) / $total
Write-Host "✅ Drive $driveName uses $percent%, $(Bytes2String $free) free of $(Bytes2String $total)" Write-Host "✅ Drive $driveName uses $percent% of $(Bytes2String $total) · $(Bytes2String $free) free"
} }
exit 0 # success exit 0 # success
} catch { } catch {

View File

@ -7,7 +7,8 @@
.EXAMPLE .EXAMPLE
PS> ./install-updates.ps1 PS> ./install-updates.ps1
(1/2) Checking drive space... (1/2) Checking drive space...
Drive C: uses 56%, 441GB free of 999GB Drive C: uses 56% of 1TB · 441GB free
(2/2) Installing updates from winget and Microsoft Store... (2/2) Installing updates from winget and Microsoft Store...
... ...
.LINK .LINK
@ -22,7 +23,7 @@ try {
if ($IsLinux) { if ($IsLinux) {
"⏳ (1/5) Checking drive space..." "⏳ (1/5) Checking drive space..."
& "$PSScriptRoot/check-drive-space.ps1" / & "$PSScriptRoot/check-drive-space.ps1" /
""
"⏳ (2/5) Querying latest package information..." "⏳ (2/5) Querying latest package information..."
& sudo apt update & sudo apt update
@ -41,7 +42,7 @@ try {
} else { } else {
"⏳ (1/2) Checking drive space..." "⏳ (1/2) Checking drive space..."
& "$PSScriptRoot/check-drive-space.ps1" C & "$PSScriptRoot/check-drive-space.ps1" C
""
"⏳ (2/2) Installing updates from winget and Microsoft Store..." "⏳ (2/2) Installing updates from winget and Microsoft Store..."
"" ""
& winget upgrade --all --include-unknown & winget upgrade --all --include-unknown