Coming Soon: GET:IT Endpoint Management 1-Day Conference on September 28th at 9:30 AM ET Coming Soon: GET:IT Endpoint Management 1-Day Conference on September 28th at 9:30 AM ET

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

  • 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.

Live Webinar: Active Directory Security: What Needs Immediate Priority!Live on Tuesday, October 12th at 1 PM ET

Attacks on Active Directory are at an all-time high. Companies that are not taking heed are being punished, both monetarily and with loss of production.

In this webinar, you will learn:

  • How to prioritize vulnerability management
  • What attackers are leveraging to breach organizations
  • Where Active Directory security needs immediate attention
  • Overall strategy to secure your environment and keep it secured

Sponsored by: