'Objective: Find Disk Free Space in all the listed servers and write to txt file 'Author: Felipe Ferreira 'Contact: felipe_los_angeles@msn.com 'PROblem the csv file is not aligned Set iFSO = CreateObject("Scripting.FilesyStemObject") Set oFSO = CreateObject("Scripting.FilesyStemObject") '-------------SET THE INPUTFILES AND OUTPUTFILE PATH AND NAMES -------- '----inputfile: should have only server names InputFile="computerlist.txt" Outputfile="spacelist_" + cstr(Month(now()))+"_"+cstr(day(now()))+".txt" Set ofile = ofso.createTextFile(OutputFile, True) Set ifile = iFSO.OpenTextFile(inputfile) Const MBCONVERSION= 1073741824 ofile.writeline "COMPUTER -> DRIVE :: FREESPACE(GB)" Do until ifile.AtEndOfLine Computer = ifile.ReadLine WScript.Echo "Extracted from: " & Computer Set objWMIService = GetObject("winmgmts://" & Computer) Set colLogicalDisk = objWMIService.InstancesOf("Win32_LogicalDisk") For Each objLogicalDisk In colLogicalDisk if objLogicalDisk.drivetype=3 then ofile.writeline Computer & "->" & objLogicalDisk.DeviceID & ":" & toGigaBytes(objLogicalDisk.freespace) end if Next Loop Function toGigaBytes(bytes) toGigabytes = int (((bytes / 1024) /1024) / 1024) End Function