Monitor Disk Space

In the following script, you monitor the disk space on a server to let you know when it falls below 100000000 bytes. If the free space falls below 100000000, a message is echoed to the screen every 5 seconds.

Option Explicit
On Error Resume Next

Const FIVE_SEC = 5000
Dim colMonitoredDisks
Dim objWMIService
Dim objDiskChange
Dim i

Set objWMIService = GetObject(“winmgmts:” _
& “{impersonationLevel=impersonate}”).ExecQuery _
(“SELECT * FROM Win32_Process”)
Set colMonitoredDisks = objWMIService.ExecNotificationQuery _
(“Select * from __instancemodificationevent within 30 where ” _
& “TargetInstance is a ‘Win32_LogicalDisk'”)

i = 0
Do While i = 0
Set objDiskChange = colMonitoredDisks.NextEvent
If objDiskChange.TargetInstance.DriveType = _
If objDiskChange.TargetInstance.Size < 100000000 Then
WScript.Echo _
“Hard disk space is below 100000000 bytes.”
End If
End If

3 thoughts on “Monitor Disk Space”

  1. Youre so cool! I dont suppose Ive read something like this before. So nice to find somebody with some original thoughts on this subject. realy thank you for beginning this up. this web site is one thing that�s needed on the web, somebody with a bit of originality. helpful job for bringing one thing new to the internet! for seagate 2tb external hard disk visit Nayashopi


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s