Last active
November 2, 2016 15:47
-
-
Save Dalmirog-zz/2559b333b990b10ad841cef175a1b124 to your computer and use it in GitHub Desktop.
Checks Tentacle's health but skipping a few drives
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$freeDiskSpaceThreshold = 5GB | |
$skipdrives = ("D:") | |
Try { | |
Get-WmiObject win32_LogicalDisk -ErrorAction Stop | ? { ($_.DriveType -eq 3) -and ($_.FreeSpace -ne $null) -and ($SkipDrives -notcontains $_.DeviceID)} | % { 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) -and ($SkipDrives -notcontains $_.driveletter) } | % { CheckDriveCapacity @{Name =$_.DriveLetter; FreeSpace=$_.FreeSpace} } | |
Get-WmiObject Win32_MappedLogicalDisk | ? { ($_.FreeSpace -ne $null) -and ($_.DeviceId -ne $null)} | % { CheckDriveCapacity @{Name =$_.DeviceId; FreeSpace=$_.FreeSpace} } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment