Skip to content

Instantly share code, notes, and snippets.

@kbarnes3
Created April 7, 2024 22:28
Show Gist options
  • Save kbarnes3/9b0114e4e491844a405a9b6d39afe464 to your computer and use it in GitHub Desktop.
Save kbarnes3/9b0114e4e491844a405a9b6d39afe464 to your computer and use it in GitHub Desktop.
Get-DiskStats.ps1
Get-PhysicalDisk | Sort-Object -Property DeviceId | Format-Table DeviceId,
FriendlyName,
Model,
@{Name="Size"; Expression={
$size = $_.Size;
$postfixes = @( "B", "KB", "MB", "GB", "TB", "PB" );
for ($i=0; $size -ge 1024 -and $i -lt $postfixes.Length; $i++) { $size = $size / 1024; };
return "" + [System.Math]::Round($size,2) + " " + $postfixes[$i];}},
FirmwareVersion,
SerialNumber,
BusType,
PhysicalLocation -Auto
Get-PhysicalDisk | Get-StorageReliabilityCounter | Sort-Object DeviceId | ft DeviceId,*Laten*,Temp*,Power*,*Error*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment