'Sending log message to the WhatsUp Event Viewer Context.LogMessage "Checking Address=" & Context.GetProperty("Address") 'Set the result code of the check (0=Success, 1=Error) Context.SetResult 0, "No error" ' Default percentage is 10% Const WARNING_THRESHOLD = 10 ErroredDrives = 0 On Error Resume Next ' Uncomment the next line to debug the credentials 'Context.LogMessage "User: " & Context.GetProperty("CredWindows:DomainAndUserid") & " Password: " & Context.GetProperty("CredWindows:Password") Set objLocator = CreateObject( "WbemScripting.SWbemLocator" ) Set objWMIService = objLocator.ConnectServer ( Context.GetProperty("Address"), "root/cimv2", Context.GetProperty("CredWindows:DomainAndUserid") , Context.GetProperty("CredWindows:Password") ) objWMIService.Security_.impersonationlevel = 3 Set objDiskDrives = objWMIService.ExecQuery ("Select * from Win32_LogicalDisk Where DriveType=3") For Each objDrive in objDiskDrives PercentFreeSpace = (objDrive.FreeSpace / objdrive.Size * 100) Context.LogMessage "Drive "&objDrive.deviceID&" has "&PercentFreeSpace&" percent free disk space" If PercentFreeSpace < WARNING_THRESHOLD Then ErroredDrives = 1 + ErroredDrives End If Next If ErroredDrives > 0 Then Context.LogMessage ErroredDrives Context.SetResult 1, "Less than "&WARNING_THRESHOLD&"% free space on one or more drives" End If=