'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" ' Constants convert freespace from bytes to megabytes and set the threshold. Const CONVERSION_FACTOR = 1048576 'Default Threshold is 1.5GB Const WARNING_THRESHOLD = 1500 On Error Resume Next 'Uncomment the next line for Debugging 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 FreeMegaBytes = objDrive.FreeSpace / CONVERSION_FACTOR If FreeMegaBytes > WARNING_THRESHOLD Then Context.LogMessage "Drive " & objDrive.deviceID & " is OK" End If If FreeMegaBytes < WARNING_THRESHOLD Then Context.SetResult 1, "Drive " & objDrive.deviceID & " has less than "&WARNING_THRESHOLD&" MB free space" End If Next=