$outboxPath = "C:\Myhealth FTP\FTP Outbox\" $hostname = hostname.exe $logentry = "" $localDisk = Get-PSDrive C $freeSpaceInGb = [math]::Truncate(($localDisk.Free/(1024*1024*1024))) Write-Host "Free space: $freeSpaceInGb GB" if ($freeSpaceInGb -lt 1) { Write-Host "CRITICAL: There is less than 1 GB of free disk space remaining!" $logentry = "$(Get-Date) - CRITICAL: There is less than 1 GB of free disk space remaining on host $hostname" Add-content ($outboxPath + "``[CRITICAL``]``[0 GB``] " + $hostname + ".txt") -value $logentry } elseif($freeSpaceInGb -lt 10) { Write-Host "WARNING: There is $freeSpaceInGb GB of free disk space remaining!" $logentry = "$(Get-Date) - WARNING: There is less than 10 GB of free disk space remaining on host $hostname" Add-content ($outboxPath + "``[WARNING``]``[" + $freeSpaceInGb + " GB``] " + $hostname + ".txt") -value $logentry } else { Write-Host "More than 10 GB of disk space is available!" } #Start-Sleep 2