Skip to content

PowerShell script to list the free space on your drives

Here is the command:

Get-WMIObject Win32LogicalDisk | ForEach-Object {[math]::truncate($.freespace / 1GB)}

But you could shorten it with some abbreviations:

gwmi Win32LogicalDisk | % {[math]::truncate($.freespace / 1GB)}

And if you want precision rather than a clean answer:

gwmi Win32LogicalDisk | % {$.freespace / 1GB}

The commands above will list the free space on each of your computers logical disks, so expect to see a list. Naturally, CD and DVD drives will be listed as having 0 free space.