En este post dejare el codigo en PowerShell para obtener el espacio disponible del disco duro por particion.


$partitions= Get-WmiObject -Class Win32_LogicalDisk -Filter 'DriveType = 3' |Select-Object PSComputerName, Caption,@{N='Capacity_GB'; E={[math]::Round(($_.Size / 1GB), 2)}},@{N='FreeSpace_GB'; E={[math]::Round(($_.FreeSpace / 1GB), 2)}},@{N='PercentUsed'; E={[math]::Round(((($_.Size - $_.FreeSpace) / $_.Size) * 100), 2) }},@{N='PercentFree'; E={[math]::Round((($_.FreeSpace / $_.Size) * 100), 2) }}

foreach($z in $partitions)
{  
    Write-Host "Particion         : $($z.Caption)" ;    
    Write-Host "Capacidad Total   : $($z.Capacity_GB)  GB" ;    
    Write-Host "Espacio Libre     : $($z.FreeSpace_GB) GB" ;    
    Write-Host "Porcentaje Usado  : $($z.PercentUsed)  %" ;    
    Write-Host "Porcentaje Libre  : $($z.PercentFree)  %" ;   
    Write-Host "";   
}


La salida es la siguiente:

Particion : C:
Capacidad Total : 368.1 GB
Espacio Libre : 123.73 GB
Porcentaje Usado : 66.39 %
Porcentaje Libre : 33.61 %

Particion : E:
Capacidad Total : 97.14 GB
Espacio Libre : 19.71 GB
Porcentaje Usado : 79.71 %
Porcentaje Libre : 20.29 %

Si le sirvió no olviden comentar.

Saludos.