HEX
Server: Microsoft-IIS/10.0
System: Windows NT ITPWINWEBSVR22 10.0 build 20348 (Windows Server 2022) AMD64
User: www.conferencesearch.co.uk (0)
PHP: 8.3.30
Disabled: NONE
Upload Files
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