VeeamON 2021: Free Online Conference - Register Now VeeamON 2021: Free Online Conference - Register Now

VB Script to Report Drive size in GB

Home Forums Scripting Windows Script Host VB Script to Report Drive size in GB

Viewing 1 post (of 1 total)
  • Author
    Posts
  • Avatar
    jdeguerre
    Member
    #160673

    I need to figure out how to have VB report drive size in GB rather than in Bytes.

    This is what I use now,,,

    Const HARD_DISK = 3
    strComputer = “.”
    Set objWMIService = GetObject(“winmgmts:” _
    & “{impersonationLevel=impersonate}!\” & strComputer & “rootcimv2”)
    Set colDisks = objWMIService.ExecQuery _
    (“Select * from Win32_LogicalDisk Where DriveType = ” & HARD_DISK & “”)
    For Each objDisk in colDisks
    Wscript.Echo “DeviceID: “& vbTab & objDisk.DeviceID
    Wscript.Echo “Free Disk Space: “& vbTab & objDisk.FreeSpace
    Next

    Thanks in advance

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

Free Online Conference - May 25th and 26th

VeeamON 2021: Free Online Conference

Join us to gain your professional edge with technical and visionary learning from the brightest minds in IT at the definitive conference for Modern Data Protection.

Register Now

Sponsored By