Skip to content

Instantly share code, notes, and snippets.

@joeypiccola
Last active February 2, 2017 17:04
Show Gist options
  • Save joeypiccola/ef2029ad8b0afe0b49465eb6791c42ba to your computer and use it in GitHub Desktop.
Save joeypiccola/ef2029ad8b0afe0b49465eb6791c42ba to your computer and use it in GitHub Desktop.
This snippet came from http://www.computerperformance.co.uk
Get-WmiObject Win32_logicaldisk -ComputerName LocalHost | Format-Table DeviceID, MediaType, @{Name="Size(GB)";Expression={[decimal]("{0:N0}" -f($_.size/1gb))}}, @{Name="Free Space(GB)";Expression={[decimal]("{0:N0}" -f($_.freespace/1gb))}}, @{Name="Free (%)";Expression={"{0,6:P0}" -f(($_.freespace/1gb) / ($_.size/1gb))}} -AutoSize
@joeypiccola
Copy link
Author

Looks like this.

DeviceID MediaType Size(GB) Free Space(GB) Free (%)
-------- --------- -------- -------------- --------
C:              12      372            353   95 %
P:              12     4471           3447   77 %
S:               0     5335            293    6 %
W:              12       10             10   99 %

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment