mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-11-30 11:54:32 +01:00
Update check-drive-space.ps1
This commit is contained in:
parent
41c83f9ec0
commit
ffd527dbe2
@ -13,9 +13,8 @@ if ($Drive -eq "" ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$FreeSpace = (get-psdrive $Drive).free
|
$FreeSpace = (get-psdrive $Drive)
|
||||||
if ($lastExitCode -ne "0") { throw "'get-psdrive $Drive' failed" }
|
[int]$FreeSpace = (($FreeSpace.free / 1024) / 1024) / 1024
|
||||||
[int]$FreeSpace = (($FreeSpace / 1024) / 1024) / 1024
|
|
||||||
|
|
||||||
if ($FreeSpace -lt $WarningLevel) {
|
if ($FreeSpace -lt $WarningLevel) {
|
||||||
write-warning "Drive $Drive has only $FreeSpace GB free space left! (warning level is < $WarningLevel GB)"
|
write-warning "Drive $Drive has only $FreeSpace GB free space left! (warning level is < $WarningLevel GB)"
|
||||||
|
Loading…
Reference in New Issue
Block a user