Last active
December 2, 2017 02:23
-
-
Save mattmcnabb/d0b97325db21fbd1979283b23b12a1a8 to your computer and use it in GitHub Desktop.
Create a disk space doughnut chart
This file contains 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
$disks = Get-WmiObject -ClassName Win32_LogicalDisk | |
ForEach ($disk in $disks) { | |
$FreeSpace = [Math]::Round($disk.FreeSpace / 1GB, 2) | |
$UsedSpace = [Math]::Round(($Disk.Size - $disk.FreeSpace) / 1GB, 2) | |
New-UDColumn -Content { | |
New-UdChart -Title $Disk.DeviceId -Type Doughnut -Endpoint { | |
[PSCustomObject]@{Space = $UsedSpace; Name = "UsedSpace"}, | |
[PSCustomObject]@{Space = $FreeSpace; Name = "FreeSpace"} | | |
Out-UDChartData -DataProperty "Space" -LabelProperty "Name" | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment