mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-11-22 07:53:21 +01:00
Update check-drives.ps1
This commit is contained in:
parent
6da9a90a3e
commit
46aff13090
@ -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,10 +26,10 @@ try {
|
||||
} else {
|
||||
$Reply = "Drive $($Drive.Name) has $($Free) GB left, $($Total) GB total."
|
||||
}
|
||||
& "$PSScriptRoot/give-reply.ps1" "$Reply"
|
||||
"* $Reply"
|
||||
}
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user