Skip to content
 

Quickie: Get free disk space with Powershell and wmi

Quick and dirty

gc work.txt |foreach{
$val=(gwmi -computername $_ -Query "SELECT FreeSpace FROM Win32_LogicalDisk WHERE DeviceID = 'C:'").FreeSpace / 1Gb;
echo "$_ $val"
}

Leave a Reply