Suppress Health Check Disk Space For Drive on Deployment Target


I have seen similar questions in “Legacy” posts, but this doesn’t seem to have been addressed - or at least I cant find out how to do it. It doesn’t seem to be covered in Machine Policies.

The Problem: I have a machine that has multiple drives, and some of them are small and not involved in auto deployment, however the Health Check checks the space on every drive on a Machine and reports it as being low on space. This means every single run of the Health Check appears to have warnings - I never get a clean one.

What I’d like to be able to do is provide a hint within a Machine settings to ‘ignore’ the “D” drive or similar. That way I can prevent these unnecessary reports. There could be other more complex solutions…but this is the simplest one I think that would solve my issue.

Hi Stuart,

Thanks for getting in touch!

My initial thought on this would be to amend the script being used by the machine policy to exclude the non-essential drives.
For example, you could amend the initial try statement to target a specific drive letter, or exclude others.
e.g. this will only check the C: drive

$freeDiskSpaceThreshold = 5GB

Try {
	Get-WmiObject win32_LogicalDisk -ErrorAction Stop  | ? { ($_.DriveType -eq 3) -and ($_.FreeSpace -ne $null) -and ($_.DeviceID -eq "C:")}  |  % { CheckDriveCapacity @{Name =$_.DeviceId; FreeSpace=$_.FreeSpace} }
} Catch [System.Runtime.InteropServices.COMException] {
	Get-WmiObject win32_Volume | ? { ($_.DriveType -eq 3) -and ($_.FreeSpace -ne $null) -and ($_.DriveLetter -ne $null)} | % { CheckDriveCapacity @{Name =$_.DriveLetter; FreeSpace=$_.FreeSpace} }
	Get-WmiObject Win32_MappedLogicalDisk | ? { ($_.FreeSpace -ne $null) -and ($_.DeviceId -ne $null)} | % { CheckDriveCapacity @{Name =$_.DeviceId; FreeSpace=$_.FreeSpace} }	

I hope this helps, please let me know if you have any further questions.


This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.