Running Actions Based on #ConfigMgr Status Filter Rules with #PowerShell

Here is an example of running a custom action when an Application is deployed (based on status filter rule).

Save this script as “C:\Scripts\StatusFilter\NoSecretDeployments.ps1”

#status filter variables:
#New Deployment of Application
#Source: SMS Provider
#Message ID: 30226
#Run Command (combine the next three lines, replace the # with a space:
#-command "& {c:\scripts\statusfilter\nosecretdeployments.ps1
#-computername '%msgsys' -msgdesc '%msgdesc'}"




function write-log ($string)
    $string + " " + (get-date) `
    | Out-File C:\scripts\StatusFilter\NoSecretDeployments.log -Append

write-log ("Source " + $ComputerName)
write-log ($MSGDesc)

Now create a new application, and observe NoSecretDeployments.log in c:\scripts\statusfilter. You can also debug the execution by reviewing statmgr.log:


In this example, you see how we can easily write the information to a log file. You can take this basic example, and leverage the Send-MailMessage cmdlet so that the script automatically notifies a distribution list each time an application deployment is created.

Learn more about Status Filter Rules:

Learn more about command-line parameters for Status Filter Rules:


Happy Scripting!




About Greg Ramsey
Greg Ramsey is a Distinguished Engineer for Dell Digital - Services. He has a B.S. in Computer Sciences and Engineering from The Ohio State University and has co-authored many books over the years. Greg is also a board member of the Northwest System Center User Group and the Midwest Management Summit. ​Greg has been a Microsoft Endpoint Manager (ConfigMgr, Intune) MVP for over 14 years.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: