ConfigMgr

How to use ConfigMgr Status Filter Rules to Send Notifications of New Application Deployments 

Topics: ConfigMgr

Who doesn’t love a good automation? I sure do. Over the years as a SysAdmin, I’ve found that the more of my job I can automate, the easier my daily work becomes. This becomes even more important when managing something as complex as Microsoft Configuration Manager. One of the ways I’ve found to do this is by using Status Filter Rules. At a high level, ConfigMgr components constantly log status messages—application stats, component health, site-system events, and more. Status Filter Rules let you act on those messages when specific criteria are met. Because a rule can run any program—yes, even PowerShell—you unlock countless automation scenarios. You can learn more about ConfigMgr Status Messages in this doc, Use the Status System in Configuration Manager.  

In this walkthrough, we’ll use a Status Filter Rule to email IT when Recast Application Manager creates a new application. First, a quick intro: Application Manager offers a 3,900-app catalog and one interface for deployment, patching, and retirement across ConfigMgr and Intune.  

Start by opening Monitoring > Overview > System Status > Status Message Queries in the ConfigMgr console. 

Right-click All Status Messages > select Show Messages. Pick a time window that covers the deployment run; ConfigMgr returns a long list. 

This can take some time to sift through, so knowing the exact run time narrows the search and saves clicks. For example, my deployment ran at 2:10 PM, so I scroll to messages stamped around that minute. 

Status Messages

The exact message I’m concerned about is the actual creation of the application. Double-clicking reveals the details we’ll need for the rule—capture them in a screenshot.  

With that info, switch to Administration > Site Configuration > Sites, select your site, and open Status Filter Rules from the ribbon. 

Status Filter Rules - Location

Once the window comes up, click Create to make a new rule and give it a name. I’ll call mine Application Manager Deployment Email Notification. From the status message I viewed earlier, I can fill out the pertinent information. We want to make this as specific as possible to avoid triggering it arbitrarily. One of the most important aspects to focus on is the exact MessageID, as each ID corresponds to a specific action. Most user-initiated actions begin with a code in the 30xx range. For a deeper dive into these, System Center Dudes offers an excellent blog post on the topic. 

Tip: Use SCCM Status Message MessageID to audit administrator actions effectively. If this field is left blank, the rule will trigger far too often. 

Status Filter Rules - Setup

After filling in that information, click Next > then Run a program checkbox. This is where the magic begins. Since I can run any program I want here, I will call a PowerShell script to process the email notification. Let’s switch gears and briefly look at that script. I have created a simple script that deciphers the status message description and uses regex match to make the output more friendly than using the Send-MailMessage command to send the email notification. This script can be much more complex, and you can make the output look fancier. However, for this demo, I have enough to accomplish my goal. 

Param($description)

#make email friendly, using regex to decipher message description
$patternappname = "application\s_+(.*?)_\s+to collection"
if($description -match $patternappname){
    $applicationname = $matches[1]
}
$patterncollectionname = "(?<=to collection\s_)(.*)_"
if($description -match $patterncollectionname){
    $collectionname = $matches[1]
}

$Subject = "New Recast Application Manager App Deployed"

$Message = "$applicationname has been deployed to $collectionname."

$From = "IT Administrator <sourceemail>"

$To = "IT Administrator <destinationemail>"

$SmtpServer = "smtp server"

$secpasswd = ConvertTo-SecureString "application password" -AsPlainText -Force
$cred = New-Object System.Management.Automation.PSCredential ("username", $secpasswd)

Send-MailMessage -Subject $Subject -Body $Message -From $From -To $To -SmtpServer $SmtpServer -UseSsl -Credential $cred 

Now that I have completed my script, I can save it to a network share or somewhere only administrators can access. For demo purposes, I have saved mine to a temp folder on my C drive. Back in ConfigMgr, under my Run Program field, I will enter the following command: 

"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -command "& {C:\temp\Send-MailStatusFilterNewApp.ps1 -description '%msgdesc'}"  

When the criteria is met on the status filter rule it will trigger the run of the PowerShell script and pass the status message description into the script, which we can then manipulate. Click Next, review the summary, click Next again to create the rule, and then Close.  

The rule is now live—time to test. If I create a new deployment process in Application Manager, I will get an email notification once it has been imported into ConfigMgr. 

New Application Notification

Conclusion: ConfigMgr Status Filter Rules Applied to Send Notifications 

And there we have it—a great way to use Configuration Manager Status Filter Rules to get an email when a new application has been created! This is just the tip of the iceberg when it comes to using these rules, so I hope this helps you create your own automations! 

Back to Top