Command line notifications and variables
Published Jan 21 2019 03:30 PM 252 Views

First published on MSDN on Mar 14, 2008

When enabiling modem paging (or similar) it is often a requirement to pass the user name or phone number of the user being contacted to the application handling the paging operation.  In MOM 2005 this was easily done using the $operator$ command line variable.  It is still very easy to do in OpsMgr 2007 but the mechanics have changed.


In OpsMgr 2007 the $operator$ variable is replaced with the $Data/Recipients/To/Address/Address$ variable.  This variable is documented on several other blog entries but is not visible on the 'flyout' option list when selecting the command line variables to use.  Using this variable it is possible to pass the 'delivery address' as defined on each recipient to the command line being executed in the notification channel.  A few examples of how this would work might be helpful.


Command line delivery channel

For this channel we will be using the 'net send' command to display whatever text is defined in the variable - the variable contents are defined per recipient.  While this is a simple example, the use of this variable could be paired with whatever executable you need to run to facilitate notification.

To test we create two recipients - each with different data in the 'Delivery address' field.  For our testing, both recipients we have a subscription that will respond to any alert.

Recipient 1


And the corresponding message


Recipient 2


And the corresponding message


This ability gives a great deal of flexibility.  If you have a command line that expects an email address as a  paging parameter parameter, it would be possible to create a generic recipient and, for the mail address, input an Exchange distribution list rather than a specific email address.  Doing so offloads email distribution from OpsMgr to Exchange.  In this way you would greatly reduce the required number of recipient/notification device combinations.


If you have a command line that expects a phone number, you could pass the phone number information one of two different ways.  First, you could have a recipient/notification device combination for every recipient - where each notification device has the required phone number for the paired recipient  A second way would be to have a generic recipient and on that recipients delivery address field, list all of the phone numbers you need to receive the page separated by some delimiter (commandly a semi-colon).  Using method 2 would require that the executable/script/whatever being called on the command line be able to parse through the list of phone numbers and break it down to the individual pagers - calling the pager aplication once per number supplied.



Version history
Last update:
‎Apr 07 2020 09:19 AM
Updated by: