Jitbit Blog about Customer Support

Setting up a low-memory email alert on a Windows server

Apr 25 2014
Since most of our customers are helpdesk teams and IT-support departments, we will sometimes publish useful tips for IT pros on this blog.

This is how you set up a low-memory email alert on a Windows 2012 Server:

  1. Create a file named "sendLowMemMsg.vbs" with the following content. This script simply sends an email to a specified address. We need this file because the "send email" task has been deprecated in Windows 2012 for some reason (was present in Windows 2008 server and below). Remember to change the emails and server details to fit your settings:
    Set Msg = CreateObject("CDO.Message")
    
    With Msg
    
     .To = "[email protected]"
     .From = "[email protected]"
     .Subject = "low memory"
     .TextBody = "low memory, check the server now"
    
     .Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 
     .Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mail.yourserver.com"
     .Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
     .Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
     .Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False
     .Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "smtp-user"
     .Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "smtp-password"
    .Configuration.Fields.Update
    
     .Send
    End With
    
  2. Go to "Task Scheduler - Task Scheduler Library - Create task" - Enter a name "SendLowMemMsg". Make sure it runs when NO user is logged on. Add an action that will execute your VBS-script. Now test the task to make sure you get the email. If not - debug.
  3. Run "Administrative tools" - "Performance monitor" - "Data Collector sets" - "User defined" - right-click - "New" - "Create manually" - "Performance counter alert". Add a Logical Disk performance counter - "Available MBs". Set "alert when" = "below", value - desired value. Say, 100 megabytes. "Finish"
  4. Now expand your newly created collector set, double click the collector, choose "alert task" - enter "SendLowMemMsg" into the task name.

comments

Brought to you by

Help desk software

Jitbit Helpdesk