Here is the command:
Get-WMIObject Win32_LogicalDisk | ForEach-Object {[math]::truncate($_.freespace / 1GB)}
But you could shorten it with some abbreviations:
gwmi Win32_LogicalDisk | % {[math]::truncate($_.freespace / 1GB)}
And if you want precision rather than a clean answer:
gwmi Win32_LogicalDisk | % {$_.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.
Posts
- Example Code (17)
- Programming (33)
- Random Geekiness (36)
- Security (30)
- Solutions (37)
