Skip to content

Instantly share code, notes, and snippets.

@ArockiaAntony
Created February 17, 2016 06:39
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 ArockiaAntony/e3982e7fcc8a44381b71 to your computer and use it in GitHub Desktop.
Save ArockiaAntony/e3982e7fcc8a44381b71 to your computer and use it in GitHub Desktop.
#Get Logical Parition usage in percentage
#Written by Arockia
Get-WmiObject win32_logicaldisk -Filter "DriveType=3" | select DeviceID,Size,Freespace | Format-Table -Property DeviceID,@{name="Total_Space";expression={[math]::Round(($_.Size/1MB)/1024,2).ToString()+" GB"}},@{name="Free_Space";expression={[math]::Round(($_.Freespace/1MB)/1024,2).ToString()+" GB"}}, @{name="Usage Percentage";expression={[math]::Round(((([math]::Round(($_.Size/1MB)/1024,2)-[math]::Round(($_.Freespace/1MB)/1024,2))/[math]::Round(($_.Size/1MB)/1024,2))*100),2).ToString()+" %"}} -AutoSize
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment