File: D:/bin/scripts/PowerShell/DriveSpaceCheck.ps1
# (SS,19/11/2023) Drive Space Check for C, D, E for 30 GB $MinFreeSpaceGB
# Email sent each time, alert email is sent if space is below 30 GB on any of the drives
#. D:\Bin\Scripts\Utils.ps1
. D:\Bin\Scripts\PowerShell\Utils.ps1
$result = GetFreeDriveSpaceInfo 30 "C,D,T"
Write-Output $result
$subject = "Server Free Drive Space"
if ($result.Contains("LOW")) {
Write-Output "ALERT"
$priority = 2 # high priority
$subject = "ALERT! $subject"
}
else {
Write-Output "OK"
$priority = 0 # low priority
}
SendEmail $subject $result $priority