When deploying an operating system with SCCM / MEMCM, monitoring your deployment is crucial. You can use reports in a more dynamic way. Imagine receiving an email saying “Hey your deployment is complete. The computer can be delivered to the client”. SCCM can send an email based on a specific status message generated by the site server. And this is exactly what will be done in this blog post.
SCCM records everything action in Status Messages. You are probably familiar with the tons server logs files but SCCM also records everything on the site server itself. A quick look at the Status message shows that there’s tons of available information.
Status Message
- In the SCCM Console
- Go to Monitoring / System Status / Status Message Queries / All Status Message
- Status Message shows all actions, there’s lots of valuable information in there
Yeah great !… now what? Using the power of PowerShell, I tell SCCM to send an email each time an event is generated. With imagination, you can do pretty cool stuff in there
SCCM OSD Send Email – Status Filter Rules
We’ll use a Status filter rule to run our script.
It permits to do an action when a specific code is generated. In my example, I’ll use MessageID 11171 to run a Powershell script. MessageID 11171 means : Task Sequence completed
- In the Configuration Manager Console
- Open Administration / Sites / Status Filter Rules
- In Status Filter Rules window, click Create
- On the Create Status Filter Rule wizard, fill the following text boxes:
- Name : Task Sequence email
- Source : Client
- Message ID : 11171
- Property : Package ID
- Property Value – PS10000A (change the value with your TS ID). You can find your task sequence PackageID in the console. Software Library / Operating Systems / Task Sequences
- In the Action tab at the top
- Check Run a program and enter the following program: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -file D:\Scripts\OSD_Deployment_Success.ps1 -ComputerName %msgsys -TS “Windows 10 x64”
So we just told SCCM to run the PowerShell script when MessageID 11171 gets generated.
Here’s the Powershell script used for that :
Param($ComputerName,$TS)
$Subject = "$TS was successful on $ComputerName"
$Message = "$TS was successful on $ComputerName"
$From = "IT Administrator <from@you.com>"
$To = "IT Administrator <destination_email@you.com>"
$SmtpServer = "your.smtp.server"
Send-MailMessage -Subject $Subject -Body $Message -From $From -To $To -SmtpServer $SmtpServer
Change the variable ($Subject,$Message,$From,$To,$SmtpServer) to fit your environment.
Bonus tip #1: Test the PowerShell script locally before running it and see with your Exchange Administrators to avoid this error “Send-MailMessage: Unable to connect to the remote server”.
Bonus tip #3: If you’re using Unknown Computer collection and receiving MININT-XXXX name, refer to this article which explains it.
Bailey Raimo
02.19.2020 AT 07:36 AMvedant
07.16.2019 AT 04:24 AMSeery Lazos
03.19.2019 AT 02:58 AMRobert
02.19.2019 AT 09:29 AMRobert
03.01.2019 AT 04:11 PMAndy
09.25.2018 AT 10:59 AMMuzaffer
08.02.2018 AT 06:46 AMJohn Wasko
09.27.2017 AT 09:19 AMJose Camacaro Latouche
08.31.2017 AT 01:42 PMJason
10.06.2015 AT 01:23 PMJose Garcia
01.28.2016 AT 01:02 PMTom
09.07.2017 AT 05:01 PMDerryn
09.28.2015 AT 10:58 AMBenoit Lecours
09.30.2015 AT 07:31 AMDon Lynch
09.23.2015 AT 10:10 AMRandy
11.08.2018 AT 02:25 PMJSG2006
02.23.2016 AT 05:59 PMDennis
07.05.2015 AT 02:55 PMBenoit Lecours
07.06.2015 AT 10:08 AMEvgeniy
04.02.2015 AT 09:15 AMBenoit Lecours
04.07.2015 AT 07:58 AMFlorian
03.26.2015 AT 02:33 AMBenoit Lecours
03.27.2015 AT 06:48 AMPeter
02.10.2015 AT 02:42 PMBenoit Lecours
02.10.2015 AT 03:01 PMKieran
03.11.2015 AT 10:54 PMDerryn
09.30.2015 AT 09:47 AMBenoit Lecours
09.30.2015 AT 10:36 AMMartin
01.28.2015 AT 05:41 PMBenoit Lecours
01.28.2015 AT 07:49 PM