daknetworks.com

You are here: Blog Powershell Get Disk Space

Powershell Get Disk Space

Here is how to get the disk space in powershell with GB (aka human readable numbers):

get-psdrive

Here it is cleaned up a bit:

get-psdrive -PSProvider filesystem | Format-Table -Wrap -AutoSize -Property Root,@{Name='UsedGB';Expression={[math]::round($_.used/1gb,2)}}, @{Name='FreeGB';Expression={[math]::round($_.free/1gb,2)}}, @{Name='PctFree';expression={$_.free/($_.free+$_.used)*100 –as [int]}}

It has every connected drive,  drive letter, used GB, free GB and Percentage Free GB.

 

Contact Dak Networks

We are not taking on new clients at this time.