March 12 2010

Send SCCM task sequence email report

I use a maximum of one Google Ad per post to help offset some of my blog hosting costs.


I wanted an easy way to know if OS deployments were failing or succeeding. We’ve come up with a good way of sending an email outlining task sequence completion status.

  • In SCCM, create a Status Filter rule by going to Site Database – Site Management – Primary Site – Site Settings – Status Filter Rules.
  • On the general tab, use Component : Task Sequence Manager, Message ID: 11170 . (11170 signifies failure, 11171 is for success.)
  • On the actions tab, tick Run a program and use something like ‘powershell.exe D:SCRIPTSTS_Email_Notification.PS1 %msgsys’.

TS_Email_Notification.PS1 should contain the following:

$erroractionpreference = "SilentlyContinue"
$strSMTP = ""
$strSubject = "SCCM OSD Deployment Completed for $strComputerName"
$strBody = "$strComputerName has Completed the Task Sequence"
$MailMessage = New-Object System.Net.Mail.MailMessage
$MailMessage.IsBodyHtml = $true
$SMTPClient = New-Object System.Net.Mail.smtpClient
$ = $strSMTP
$Sender = New-Object System.Net.Mail.MailAddress("", "Sender")
$Recipient = New-Object System.Net.Mail.MailAddress("", "Recipient")
$MailMessage.Sender = $Sender
$MailMessage.From = $Sender
$MailMessage.Subject = $strSubject
$MailMessage.Body = $strBody

You just need to adjust the above Powershell script for your mail settings and you will now receive an email each time there is a successful or failed OS deployment.

I use a maximum of one Google Ad per post to help offset some of my blog hosting costs.


Tags: , , , , , , , , ,

Posted March 12, 2010 by danovich in category "Powershell", "SMS / SCCM


  1. By bizzarro on

    i’ve set up a status alert like you said with the script but it doesn’t run it. I changed it to look for the message ID only 10008 for completed successfully.

    I configured the script and ran the command line manually and it works. But after the job runs successfully it never runs the other program.

    Is there anything I need to look at or if there’s a log I can view to see on why it didn’t run.

  2. By danovich (Post author) on

    bizzarro, I was also having inconsistent resulting using the powershell script, so I’ve re-written it with VBScript and is as follows:


    Dim sComputerName
    Set args = WScript.Arguments
    sComputername = args.Item(0)

    Set objMessage = CreateObject(“CDO.Message”)
    objMessage.Subject = “SCCM OS deployment failed for ” & sComputername
    objMessage.From = “”
    objMessage.To = “”
    objMessage.TextBody = sComputername &” has failed a task sequence”

    ‘==This section provides the configuration information for the remote SMTP server.
    ‘==Normally you will only change the server name or IP.
    objMessage.Configuration.Fields.Item _
    (“”) = 2

    ‘Name or IP of Remote SMTP Server
    objMessage.Configuration.Fields.Item _
    (“”) = “”

    ‘Server port (typically 25)
    objMessage.Configuration.Fields.Item _
    (“”) = 25


    ‘==End remote SMTP server configuration section==


    ‘ END VBS

    The action for the status filter rule is “CSCRIPT.EXE D:SCRIPTSemail.vbs %msgsys” with Message ID as “11170” and Component as “Task Sequence Manager”

  3. By bizzarro on

    Actually the problem was that I can’t use it as a command line within the Actions tab. I put the command line into a .cmd file to run after the job is done. That works, but the %msgsys doesn’t seem to be working. It says “msgsys” rather than the computer name from what I read in the documentation on the command lines.



  4. By danovich (Post author) on

    Have you tried just using ‘CSCRIPT.EXE D:SCRIPTSemail.vbs %msgsys’. I am sure this works. If you start using batch files you will lose the parameters that are being fed into the command.

  5. By bizzarro on

    Sorry, I was referring to your original Powershell script when I ran that command.

    I just piece together one in VB from another code I found online, should of just came here instead to use yours. The only problem I have in my VBscript is that I can’t set the argument to the strComputer variable. It says object or method not supported Item. If I leave the argument as is and use that as the variable it works fine. For this case I only need one argument but wonder why other posted scripts work allow people to set the variable?


  6. By bizzarro on

    I have it working like your script and see where the error is in theirs. They reversed the objARgs.Item(0)= StrComputer instead of StrComputer = ojbArgs.Item(0) like you have it. That resolved that issues and now I have it working, thanks.


  7. By alexandh on

    I am trying to implement this, but it is not working. If I run the from a command prompt, it goes thru, so my setup in the status filter rule must be incorrect. I had to type in “task sequence manager” for the component, as it was not available as a drop down. Running SCCM R3. Any ideas?

  8. By tpullins on

    I also do not see Task Sequence Manager in the Component drop down list… SCCM 2007 R2

  9. By McRaae on

    I am also trying to implement this, but do not see “Task Sequence Manager” in the Component drop down list. I typed it manualy, byt it dosn’t seem to be working. I have a lot of TS errors but no mail. I have teste the mail script manualy and it works.

    SCCM 2007 R2

  10. By Tronni on

    I’ve have the same issue as above. I cant find “Task Sequence Manager” in the drop down list.

  11. By Napandee on


    First of all thanks works like a charm 🙂

    However in my SCCM the script sends multiple emails for the same client?

    Sometimes it can be 2mins between them and sometimes around 30mins.

    Any idea what to look for?

    Keep up the good work!

  12. By Napandee on

    Ofc about 1h after I posted I found the “problem”

    The status filtering rule is doing as it’s been told! It searches for the success code 11171 but imagen if you install some software via TS besides the OSD…..

    I modified my status filtering rule to search for my Windows 7 installation OSD package ID and then the spam stopped 🙂

    Hope this helps some1!


Leave a Reply