Windows Script object to get free space

Today, Mick Genie has come out same sample script to calculate theĀ  free space from particular disk drive.

Below is the sample script as you may use the following script and save it to file.vbs.

Set DiskSpace = GetObject(“winmgmts:{impersonationLevel=impersonate}”).ExecQuery (“select * from Win32_LogicalDisk where DriveType=3″)
Dim Result
For each Disk in DiskSpace
If (Disk.Name=”D:”) Then
Result = Disk.Name + ” ” + Disk.FreeSpace + ” GB”
End If

WScript.Echo Result

With above script, you may change the drive with D: to E: , F: , etc and you will get the information from the drive specifically.

Published by

Mick Genie

Mick Genie is the founder of and working at ExaBytes Network Sdn Bhd and WPWebHost web host company. He is expertise in Windows and Linux environment especially web hosting related information, tips and trick as well as the IT Information.