Skip to content

Instantly share code, notes, and snippets.

@kort3x
Created December 2, 2017 01:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kort3x/4139c06286a7e2b722fd70dd2d7194fe to your computer and use it in GitHub Desktop.
Save kort3x/4139c06286a7e2b722fd70dd2d7194fe to your computer and use it in GitHub Desktop.
creating pie charts for diskapce in universaldashbaord
$disks = Get-WmiObject -ClassName Win32_LogicalDisk -ComputerName $Computername
ForEach ($disk in $disks) {
New-UDColumn -Size 3 {
New-UdChart -Title "Speicherplatz" -Type Doughnut -Endpoint {
[PSCustomObject]@{
DeviceId = $disk.DeviceID;
Size = [Math]::Round($disk.Size / 1GB, 2);
FreeSpace = [Math]::Round($disk.FreeSpace / 1GB, 2);
} | Out-UDChartData -LabelProperty "DeviceID" -Dataset @(
New-UdChartDataset -DataProperty "Size" -Label "Size" -BackgroundColor "#80962F23" -HoverBackgroundColor "#80962F23"
New-UdChartDataset -DataProperty "FreeSpace" -Label "Free Space" -BackgroundColor "#84aa33" -HoverBackgroundColor "#8014558C"
)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment