VBScript to determine logical disk with most free space using wmi
strComputer = wscript.arguments(0)
tempFreespace = 0
Set objWMIService = GetObject(“winmgmts:” _
& “{impersonationLevel=impersonate}!\” _
& strComputer & “rootcimv2”)
Set colDisks = objWMIService.ExecQuery (“Select * from Win32_Volume”)
For Each objDisk in colDisks
if objDisk.Freespace > tempFreespace then
tempFreespace = objDisk.Freespace
returnVolume = objDisk.DriveLetter
end if
Next
wscript.echo returnVolume