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:

param([string]$strComputerName)
$erroractionpreference = "SilentlyContinue"
$strSMTP = "mail.domain.com"
$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
$SMTPClient.host = $strSMTP
$Sender = New-Object System.Net.Mail.MailAddress("sender@domain.com", "Sender")
$Recipient = New-Object System.Net.Mail.MailAddress("recipient@domain.com", "Recipient")
$MailMessage.Sender = $Sender
$MailMessage.From = $Sender
$MailMessage.Subject = $strSubject
$MailMessage.To.add($Recipient)
$MailMessage.Body = $strBody
$SMTPClient.Send($MailMessage)

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.

----------------------------------------------------------------------------