Technical Article

Disk Space Report

,

Save this Script as .vbs

 

Then from command line

 

cscript /nologo scriptname.vbs

 

 

strComputer = "."
        Set objWMIService = GetObject _
        ( "winmgmts:\\" & strComputer & "\root\cimv2")
        Set colItems = objWMIService.ExecQuery _
        ("Select * From Win32_Volume Where DriveType = 3" )
       
        
For Each objItem In colItems 
iSpc = cDbl(objItem.FreeSpace)
ispc1 = cDbl(objItem.Capacity)

WScript.Echo objItem.Label, "Drive", "has", FormatiSpc(iSpc) & "GB Free OF Volume size: " & FormatiSpc(iSpc1) & "GB"

Next

Function FormatiSpc(intSpace) 
  intSpace = intSpace/1024
  intSpace = intSpace/1024
  intSpace = intSpace/1024
  intSpace= FormatNumber(intSpace,1)
  FormatiSpc = intSpace
end Function

Rate

4.29 (7)

You rated this post out of 5. Change rating

Share

Share

Rate

4.29 (7)

You rated this post out of 5. Change rating