Automox requires a minimum of 3GB of free disk space in order to execute daily functions prioperly. This worklet checks for free disk space on the C:\ drive.
The worklet will produce a result in the Activity Log only if a host has less than 3.0GB of free space on the C:\ drive.
Evaluation:
$runCheck = {
$minDiskSpaceGB = 3.0
$diskCheck = Get-WmiObject -Class Win32_logicaldisk -Filter "DriveType = '3'" | Where-Object {$_.DeviceID -eq "C:"}| Select-Object -Property DeviceID, @{L='FreeSpaceGB';E={"{0:N2}" -f ($_.FreeSpace /1GB)}},@{L="Capacity";E={"{0:N2}" -f ($_.Size/1GB)}} | Where-Object {[float]$_.FreeSpaceGB -lt $minDiskSpaceGB}
if ( $diskCheck -eq $null )
{
return 0
}
else {
return 1
}
}
exit $exitCode = & $runCheck
Remediation:
trap { $host.ui.WriteErrorLine($_.Exception); exit 90 }
$runCheck = {
$minDiskSpaceGB = 3.0
$diskCheck = Get-WmiObject -Class Win32_logicaldisk -Filter "DriveType = '3'" | Where-Object {$_.DeviceID -eq "C:"}| Select-Object -Property DeviceID, @{L='FreeSpaceGB';E={"{0:N2}" -f ($_.FreeSpace /1GB)}},@{L="Capacity";E={"{0:N2}" -f ($_.Size/1GB)}} | Where-Object {[float]$_.FreeSpaceGB -lt $minDiskSpaceGB}
return $diskCheck.FreeSpaceGB
}
Write-Output "AX Compatibility Failure: insufficient disk space on host $gc $env:computername"
Write-Output "Free space:"
Invoke-Command $runCheck
Write-Output "GB"