Update check-drives.ps1

This commit is contained in:
Markus Fleschutz 2022-06-09 16:30:28 +02:00
parent 6da9a90a3e
commit 46aff13090

View File

@ -1,21 +1,16 @@
<#
.SYNOPSIS
Checks all drives for free space left
Checks the free space of all drives
.DESCRIPTION
This PowerShell script checks all drives for free space left (20 GB by default).
.PARAMETER MinLevel
Specifies the minimum level in Gigabyte
.EXAMPLE
PS> ./check-drives
Drive C has 172GB left (233GB total)
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz / License: CC0
Author: Markus Fleschutz | License: CC0
#>
param([int]$MinLevel = 20) # minimum level in GB
try {
$Drives = Get-PSDrive -PSProvider FileSystem
foreach($Drive in $Drives) {
@ -31,7 +26,7 @@ try {
} else {
$Reply = "Drive $($Drive.Name) has $($Free) GB left, $($Total) GB total."
}
& "$PSScriptRoot/give-reply.ps1" "$Reply"
"* $Reply"
}
exit 0 # success
} catch {