telnetMESMS–SMS Wrapper for Exchange Monitoring–Part 2…

by Andy Grogan on February 5, 2012 · 1 comment

in Exchange 2010 (General), Exchange Programming .NET, Monitoring, Nagios, Powershell

In the last part of this series I covered my new tool – telnetMESMS which allows for SMS messages to be sent via the command line to destination mobile phones. The tool makes use of a SMS web enabled API provided by http://www.intellisoftware.co.uk (sign up information is contained in part 1).

In this part I would like to give you a sample script which can give you an idea of how the tool can be used (you are, as always free to use the tool in anyway you see fit within your Exchange environments (just not for spamming mobiles)).

Notifying users of Mailbox Quota Exceeded

This is a simple little script that will check to see which users have the value “smsEnabled” within “extendedAttribute15” – if they do the script will then check the Quota Status of the users mailbox (using Get-MailboxStatistics) and if it is over (e.g. anything other “BelowLimit”) it will call the telnetMESMS.exe program and send a text message to the user letting them know that their mailbox is potentially unusable.

Therefore given the above – if you would like to use the script against mailboxes within your environment, ensure that each of you chosen mailbox has the “smsEnabled” value in “extendedAttribute15” – see below:

smsExchange007

The script takes the destination Mobile Phone number for the mailbox notification from the “Mobile” entry for the user in Active Directory (I am using my number below so I have removed a number of digits) – see below

smsExchange008

I personally find this script useful, as over the years I have lost count of the amount of senior managers who have said, I never received any warning that my mailbox was about to run out of space (these are typically the people who when they see anything from the System Administrator delete it immediately) so to send them a text message is another means of letting them know that some action in their behalf is required.

# Send a text message to a user if their mailbox is over the storage limit
# Exchange 2010 only!
# Version 1.0
# 
# Requires:
# * CustomAttribute15 on each monitored mailbox
#   to be set to smsEnabled
# * The MobilePhone AD Attribute to be populated
#   on the AD account
# * telnetMESMS tool
# * IntelliSoftware SMS Account with Credit
#
# Author: Andy Grogan
# http://www.telnetport25.com

Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010
$Mailboxes = Get-Mailbox | Select Identity,CustomAttribute15 | where {$_.CustomAttribute15 -eq "smsEnabled"}

Foreach($mbx in $Mailboxes){

    $QuotaStatus = Get-MailboxStatistics $mbx.Identity
    if($QuotaStatus -ne "BelowLimit"){
        $MobileNumber = Get-User $mbx.Identity | Select MobilePhone
        $Size = $QuotaStatus.TotalItemSize
        $Message = "Your Mailbox is over Quota: $Size"
        & 'c:\telnetMESMS\telnetMESMS.exe' $MobileNumber.MobilePhone $Message "Exchange"
    }
    
}

The script MUST be downloaded to the same folder where the telnetMESMS.exe tool is installed (this you would have installed from part 1) and should be scheduled to run at a interval which suites your organisation.

When the message has been sent – the recipient of the message should see something like the following – see below:

smsAlertExample2

I hope that you find this useful, and it gives you some ideas of some other situations where you can use the telnetMESMS tool.

Social

{ 1 comment… read it below or add one }

WilsonLast May 21, 2012 at 7:41 am

Hi,

You may also check how to send SMS from MS Exchange 2003 with Ozeki NG SMS Gateway:
http://www.sms-integration.com/p_106-ms-exchange-2003-sms.html

BR

Reply

Leave a Comment

Previous post:

Next post: