Configmgr OSD Task sequence ; Success or Failure notification

October 1, 2010 at 2:12 pm in ConfigMgr, ConfigMgr 2007, ConfigMgr 2007 R2, ConfigMgr SP2, configmgr2007, ConfigMgr2007 R3, Operating System Deployment, OSD, R3, sccm, SCCM 2007, SCCM 2007 R2, SCCM 2007 R3, SCCM 2007 SP2, sccm2007 by Kenny Buntinx [MVP]

A customers demanded for local support staff to have a simple feature in ConfigMgr 2007 . This feature would be that when operating system deployment has been launched in production , the Local Support staff would receive a simple email to say that their deployment was succeeded or not without touching any ConfigMgr console. Out of the box , this was not feasible . A colleague of mine ( Merlijn  Vanwaeyenberghe)  at  that particular customer found a rather simple but effective solution .

The steps to reproduce this solution are mentioned below :

1. Go to the Status filer Rules  in the following section  :

image 

2. Create two status filter rules as shown below .

image

3.Configure the Status filter Rules as shown below. Create a Status Filter Rule with the following properties:

· To notify when a specific TS has succeeded:

    • Source: ConfigMgr Client
    • Site Code: site code
    • Message ID: 11143
    • Property: Package ID
    • Property Value: Package ID for the OSD Task Sequence to be monitored

image

· To notify when a specific TS has failed:

    • Source: ConfigMgr Client
    • Site Code: site code
    • Component: Task Sequence Engine
    • Severity: Error
    • Property: Package ID
    • Property Value: Package ID for the OSD Task Sequence to be monitored

image

· Actions for both cases:

    • Create 2 Powershell scripts on your local drive. In my case D:\scripts\TSSucceeded_Email_Notification.PS1 and D:\scripts\TSFailed_Email_Notification.PS1 with the following code snippets that are listed below.

image

**********Code Snippet – FAILED ***********

param([string]$strComputerName)
$erroractionpreference = "SilentlyContinue"
$strSMTP = "Your SMTP server "
$strSubject = $strComputerName+": OS Deployment FAILED"
$strBody = @"
The OSD Task Sequence "The name of your tasksequence" has

    * FAILED *

op $strComputerName

http://yourSCCMServer/SMSReporting_XXX/Report.asp?ReportID=143&AdvertID=90020066&ComputerName=$strComputerName&SortRs1Col=1&SortRs1Dir=2
"@
$MailMessage = New-Object System.Net.Mail.MailMessage
$SMTPClient = New-Object System.Net.Mail.smtpClient
$SMTPClient.host = $strSMTP
$Sender = New-Object System.Net.Mail.MailAddress("zzz@Yourcompany.zzz ", "SCCM”)
$Recipient = New-Object System.Net.Mail.MailAddress( “zzz@Yourcompany.zzz, "ZZZ")
$MailMessage.Sender = $Sender
$MailMessage.From = $Sender
$MailMessage.Subject = $strSubject
$MailMessage.To.add($Recipient)
$MailMessage.Body = $strBody
$SMTPClient.Send($MailMessage)

***********Code Snippet – FAILED ***********

**********Code Snippet – SUCCEEDED **************

param([string]$strComputerName)
$erroractionpreference = "SilentlyContinue"
$strSMTP = "Your SMTP server "
$strSubject = $strComputerName+": OS Deployment Succeeded"
$strBody = @"
The OSD Task Sequence "The name of your tasksequence"" is

    * SUCCEEDED *

op $strComputerName
"@
$MailMessage = New-Object System.Net.Mail.MailMessage
$SMTPClient = New-Object System.Net.Mail.smtpClient
$SMTPClient.host = $strSMTP
$Sender = New-Object System.Net.Mail.MailAddress("zzz@Yourcompany.zzz ", "SCCM")
$Recipient = New-Object System.Net.Mail.MailAddress("zzz@Yourcompany.zzz ", "ZZZ")
$MailMessage.Sender = $Sender
$MailMessage.From = $Sender
$MailMessage.Subject = $strSubject
$MailMessage.To.add($Recipient)
$MailMessage.Body = $strBody
$SMTPClient.Send($MailMessage)

**********Code Snippet – SUCCEEDED ***********

 

    • Run a program: path to program with optional parameters !! DO NOT USE "QUOTES" !!

         image

         In this Case : c:\windows\system32\WindowsPowerShell\v1.0\powershell.exe -file D:\scripts\TSSucceeded_Email_Notification.PS1 %msgsys

 

Status filter rules can be used to perform an action when an event has occurred, for instance when an OSD Task Sequence has completed successfully or has failed, an email can be sent out to the OS staging team to inform them as shown above . Don’t let it stop you doing it for other tasks as well . Special thanks to my colleague Merlijn Vanwaeyenberghe for sharing this with us .

 

Hope it Helps ,

 

Kenny Buntinx

Tweet about this on TwitterShare on FacebookShare on Google+Share on LinkedInPin on Pinterest