Try this:
Param([string]$ComputerName="$env:computername")
clear;
function GetDrivetypeName([int]$DriveType) {
switch($DriveType) {
0 {'Unknown'}
1 {'No Root Directory'}
2 {'Removable Disk'}
3 {'Local Disk'}
4 {'Network Drive'}
5 {'Compact Disk'}
6 {'RAM Disk'}
default {'?'}
}
}
get-wmiobject -Computername $ComputerName win32_volume |
format-table Driveletter,`
Label,`
@{Name="DriveType"; Expression = {GetDrivetypeName($_.DriveType)}},`
@{Name="Capacity [GB]"; Expression = {[Math]::Round($_.Capacity/1024/1024/1024, 1)}},`
@{Name="Free Space [GB]"; Expression = {[Math]::Round($_.FreeSpace/1024/1024/1024, 1)}},`
@{Name="Free Space [%]"; Expression = {[Math]::Round(($_.FreeSpace/$_.Capacity)*100)}}`
-autosize