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.
32 Comments on “Send an Email when SCCM OSD Completes a Deployment”
I like your blog post. Keep on writing this type of great stuff. I make sure to follow up on your blog in the future. For instant support related to the Forgot AOL mail Password please visit http://www.emailscustomercare.com/forgot-aol-password/ for the best solution.
Thank you so much for this site.
Pingback: Have ConfigMgr send an email after deployment (including log parsing) – Deployment Research
Hello
I thank full to you, because you are looking comments on this post and you are active on it
I too appreciate you & System Center Dudes for all the great information, really i did learned so many new things
before sometime i got the problem for Reset Roadrunner Password then i found the link http://www.roadrunnersupport247.com/reset-roadrunner-password/ it is very helpful
Benoit,
Hopefully, you’re still seeing comments for this post!
I too appreciate you & SCDudes for all the great info.
One question on this post. We are using it and is wonderful.
Our only issue is that UNKNOWN computers always say their MININT-xxxxxx name
instead of the OSDComputerName (which we prompt for directly after PXE boot).
The %msgsys give us the MININT-xxxxxx so is there any way to get the OSDComputerName
into the email script?
Benoit and anyone else looking for this solution.
Please see:
https://www.cb-net.co.uk/microsoft-articles/configmgr/configmgr-task-sequence-email-notification-and-unknown-computers-minint-names/
Did the guys that couldn’t get this to send email when running the TS but it worked when running manually ever solve it ? I have the same issue
Bonjour Benoit,
Thank you for the very useful article but I’m not sure if %msgsys works correctly on CM1710 which I’m using? It’s not returning the actual computer name but MINT-XXXX.
ps. After 3 years of this article, people currently discussing it on SCCM Reddit!
Old Post but I am running into a couple of issues.
The first is that %msgsys is pulling the temp computer name “MNINT…” and not the name that I am using as the collection variable or the name that is reported to SCCM in it’s event log.
The second is that the subject lines are not mailing what is between the quotes but garbling it with prepended question marks and only using the first word within the quotes “???Company” instead of “Company HP 745 win 7”
Awesome guide!
Is it possible to use wild cards (%) in the “system” field when creating a status filter rule? i.e. If system name is “2017-%” will it only trigger the PS1 if the client’s name start with ‘2017- ‘?
Is it possible to include the computer model and serial number in this e-mail? I don’t know if SCCM has captured the data yet. I know the S/N is stored in SMS_G_System_PC_BIOS.SerialNumber
In the powershell script you can use get-wmiobject (gwmi) to collect that information
ex:
Get-WmiObject Win32_Computersystem -computername $ComputerName| Select-Object -expand Model
Get-WmiObject Win32_bios -computername $ComputerName| Select-Object -expand SerialNumber
Hello,
I been trying to added the Get-WmiObject Win32_Computersystem in the script but I keep getting the results of the SCCM server in the email as opposed to the client machine information. Would appreciate if you can share any tips of how I can use this command to pull the client information instead of the SCCM server.
Thanks
Is there a way I can run this for ANY task sequence? It would be awesome if there were some detail in the email as well. perhaps a link to the report with the field options already populated?
Yes, you can customize this solution : http://schadda.blogspot.ca/2012/01/sccm-2012-how-to-catch-errors-in-task.html
This works great however during my task sequence I use a HTA to name the computer by location and first 8 of the SN… but I notice in the status logs it is still showing up as a MINT-xxxxx name. Any suggestions to actually have this log the actual name of the machine so it emails the actual PC name?
Same issue I’m having. I’ve attempted a couple of suggestions but I can’t generate the true hostname consistently.
I made quite a few changes to get it to work this way.
First, I added this script as part of my task sequence instead of as a status filter. Done this way, it runs locally on the machine instead of on the Site Server.
I followed the instructions here to accomplish this:
http://schadda.blogspot.com/2012/01/sccm-2012-how-to-catch-errors-in-task.html
Then I used task sequence variables to fill the $ComputerName and $TS (%OSDComputerName% and %_SMSTSPackageName%) instead of passing them as parameters.
Then I added a step, prior to running the script, to set OSDComputerName to %_smstsmachinename% if OSDComputerName doesn’t already exist, and then use %OSDComputerName% instead of %_smstsmachinename% in all instances.
With this setup. if OSDComputerName is set you should get that value. If it’s not set, you’ll get the MININT-xxxxx name. Plus it will work in any Task Sequence and will give you the name of the task sequence.
I also added some of the other stuff that was talked about in that link (uploading the logs.)
Then I made all of these steps into a child task sequence, and reference that child task sequence in my main task sequences.
This is very cool!
However, may I know what is the computer that executes the script (i.e. the computer that sends the email message).
Is it the from site server or from the computer which the task sequence ran?
It’s the site server computer account
This is worked with local install Exchange Server?
i have error: Send-MailMessage : Cannot validate argument on parameter ‘Subject’. The argument is null or empty. Provide an argument that is not null or empty, and then try the command a
gain.
At line:2 char:27
+ Send-MailMessage -Subject $Subject -Body $Message -From $From -To $To -SmtpServe …
+ ~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Send-MailMessage], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.PowerShell.Commands.SendMailMessage
Yes it should work using a local Exchange server. Can you post your script ?
Hello, I tested it and ist working. I saw you are catching the computer Name by using %msgsys. I use the script to catch Errors and i want to catch the discription. Do you know who to do that?
Sure, you can use %msgdesc for this. In fact you can use any parameters listed : https://technet.microsoft.com/en-us/library/bb693758.aspx
Hmm, I’m not actually getting the emails.
Powershell policy is unrestricted.
If I run the script manually then I get the email…!?
Have you tried running the script under the SYSTEM account using psexec ?
Hi Benoit,
I’m experiencing the same thing as Peter.
I cannot receive the email from the event. I can manually run the command it sends the email.
If I run under PSEXEC as system is works. (although to get this to work I had to add permissions for my SCCM server to send as myself (and then set the script to send as myself)) for this to work.
any ideas?
cheers,
Kieran
I have the same issue as well. I used PS exec to run as system and I get the email. But I’m not getting the email when the TS runs.
I checked the box to write to the event log so I can see the event log that the correct status message is used. The policy is unrestricted, in my troubleshooting I also added -ExecutionPolicy Bypass still no emails.
I’m running SCCM 2012 R2 SP1
Have you done all required tasks ? Dcom permission and security rights ?
That’s awesome! A really great find. Quick question though, is there more field than the Computer name that can be passed in the script, so the email would contain the description and details from message? If so, how the variables are named? Would be really useful for message ID 11171 for task sequence failure.
Really useful site by the way guys! Keep up the great work!
Salut Martin !
Sure, there’s a whole bunch of other parameters you could add. Check this link for the full list.
Be sure to create an input parameters in the Powershell script and add the extra parameter in the Run a program filed of the Status Filter Rule.
Thanks for the kind words about the blog 😉
Pingback: How to monitor SCCM OSD | Houston Area Systems Management User Group