This post has the command I needed.

However, I was unable to get the desired result in a table format as my version of Powershell did not support Out-GridView.

Wrote the following script and saved it as FindSpace.ps1

Clear-Host
$ExchServerList = Get-Content Servers.txt
foreach( $ExSrv in $ExchServerList)
{
Get-WMIObject Win32_LogicalDisk -filter “DriveType=3″ -computer $ExSrv | ? {$_.DeviceID -like “C:”} | Select SystemName,VolumeName,@{Name=”Size(GB)”;Expression={[decimal](“{0:N1}” -f($_.size/1gb))}},@{Name=”Free Space(GB)”;Expression={[decimal](“{0:N1}” -f($_.freespace/1gb))}},@{Name=”Free Space(%)”;Expression={“{0:P2}” -f(($_.freespace/1gb) / ($_.size/1gb))}}
}

.\FindSpace.ps1 | ft -auto > Result.txt gave me the result I needed.

Note: The command inside {} is a single line one.

- Thanks, Jinesh.

About these ads