In Part 1 of this multi-part post, I created a web service to handle the actual sending of the e-mail notification.
In Part 2, I gave information about all of the scripts required to do the heavy lifting.
In Part 3, I will show you how to add a custom Pane to the MDT deployment wizard to allow the technician whether or not they want to receive the notification and how it should be sent.  This will be done in two sections since MDT 2010 and MDT 2012 handle wizard panes in completely different manners.

MDT 2010

In the Scripts folder of the deployment share, open the DeployWiz_Definition_ENU.xml file.  Decide where you want the notifications pane to appear in the wizard and insert the following XML:
<Pane id="Notifications">
  <Body><![CDATA[<H1>Specify how notifications should be sent.</H1>
    <table>
      <tr>
        <td>
          <input type=radio name="NotifyMethod" id="NRadio1" checked value="None" language=vbscript AccessKey=D>
        </td> 
        <td>
          <Label class="Larger" for=NRadio1 language=vbscript ><u class=larger>D</u>o not send notifications.</Label>
        </td>
      </tr>
      <tr>
        <td>
        </td>
        <td>
          &nbsp;
        </td>
      </tr>
      <tr>
        <td>
          <input type=radio name="NotifyMethod" id="NRadio2" Value="Email" language=vbscript  AccessKey=E> 
        </td>
        <td>
          <Label class="Larger" for=NRadio2 language=vbscript >Send notifications by <u class=larger>E</u>-Mail.</Label>
        </td>
      </tr>
      <tr>
        <td>
        </td>
        <td>
          &nbsp;
        </td>
      </tr>
      <tr>
        <td>
          <input type=radio name="NotifyMethod" id="NRadio3" value="Pager" language=vbscript oAccessKey=P>
        </td>
        <td>
          <Label class="Larger" for=NRadio3 language=vbscript >Send notifications by <u class=larger>P</u>ager.</Label>
        </td>
      </tr>
      <tr>
        <td>
        </td>
        <td>
          &nbsp;
        </td>
      </tr>
      <tr>
        <td>
          <input type=radio name="NotifyMethod" id="NRadio4" value="Text" language=vbscript AccessKey=T>
        </td>
        <td>
          <Label class="Larger" for=NRadio4 language=vbscript >Send notifications by <u class=larger>T</u>ext message.</Label>
        </td>
      </tr>
      <tr>
        <td>
        </td>
        <td>
          &nbsp;
        </td>
      </tr>
  </table>
  <label class=ErrMsg id=NoNotifyFile>Notification list not found!</label>]]></Body>
  <Condition><![CDATA[UCase(Property("SkipNotifications"))<>"YES"]]></Condition>
  <Initialization><![CDATA[InitializeNotifications]]></Initialization>
  <Condition><![CDATA[ FindTaskSequenceStep("//step[@name='Send Notification']", "ZTINotify.wsf" ) ]]></Condition>
</Pane>

This will add a custom pane that will appear in the wizard as long as there is a step in the task sequence called “Send Notification” calling the ZTINotify.wsf script and the property SkipNotifications is not set to YES.

image

In addition, we need some initialization code.

Open DeployWiz_Initialization.vbs from the Scripts folder of the deployment share.  Scroll to the bottom and add the following function:
Function InitializeNotifications
    Dim oXML
    Dim sUser
    Dim sXMLFile
    Dim sEmail
    Dim sPager
    Dim sText
    Dim RootNode
    Dim SubNode
    Dim Attribute
    Dim ChildNode
    
    Set oXML = CreateObject("Microsoft.XMLDOM")
    oXML.async = false
    sUser = Ucase(property("UserID"))
    sXMLFile = Property("DeployRoot") & "\Control\NotifyList.xml"
    
    sEmail = "None"
    sPager = "None"
    sText = "None"
    
    if not oXML.load (sXMLFile) Then
        NoNotifyFile.style.display = "inline"
        NRadio2.Disabled = True
        NRadio3.Disabled = True
        NRadio4.Disabled = True
        Exit Function
    Else
        NoNotifyFile.style.display = "none"
    end If
    
    Set RootNode = oXML.selectNodes("//address[@UserID='" & UCase(sUser) & "']")
    
    If RootNode.length = 0 Then
        NRadio2.Disabled = True
        NRadio3.Disabled = True
        NRadio4.Disabled = True
    Else
        For Each SubNode In RootNode
            For Each Attribute In SubNode.attributes
                If LCase(sUser) = LCase(Attribute.text) Then
                    For Each ChildNode In SubNode.childNodes
                        Select Case ChildNode.nodeName
                            Case "email"
                                sEmail = ChildNode.text
                            Case "pager"
                                sPager = ChildNode.text
                            Case "text"
                                sText = ChildNode.text
                        End Select
                    Next
                End If
            Next
        Next
    End If

    If sEmail <> "None" And InStr(sEmail, "@") Then
        NRadio2.Disabled = False
    Else
        NRadio2.Disabled = True
    End If
    If sPager <> "None" And InStr(sPager, "@") Then
        NRadio3.Disabled = False
    Else
        NRadio3.Disabled = True
    End If
    If sText <> "None" And InStr(sText, "@") Then
        NRadio4.Disabled = False
    Else
        NRadio4.Disabled = True
    End If
End Function



This function will parse the NotifyList.xml and enable or disable the different notification types, depending on whether or not they have values.

MDT 2012


As I mentioned earlier, MDT 2012 handles wizard panes very differently (better in my opinion) than MDT 2010.

To implement the same notifications pane in MDT 2012, we have to first create a file called DeployWiz_Notify.xml in the Scripts folder of the deployment share.  It should have the following contents:
<?xml version="1.0" encoding="utf-8"?>
<!--

' // ***************************************************************************
' // 
' // Copyright (c) Microsoft Corporation.  All rights reserved.
' // 
' // Microsoft Deployment Toolkit Solution Accelerator
' //
' // File:      DeployWiz_Definition_ENU.wsf
' // 
' // Version:   6.0.2223.0
' // 
' // Purpose:   Main Client Deployment Wizard Defintion File
' // 
' // ***************************************************************************

-->
<Wizard>
  <Global>
    <CustomScript>DeployWiz_Notify.vbs</CustomScript>
  </Global>
  <Pane id="Notify" title="Notifications">
    
<Body><![CDATA[<H1>Specify how notifications should be sent.</H1>
<table>
    <tr>
        <td>
            <input type=radio name="NotifyMethod" id="NRadio1" checked value="None" language=vbscript AccessKey=D>
        </td> 
        <td>
            <Label class="Larger" for=NRadio1 language=vbscript ><u class=larger>D</u>o not send notifications.</Label>
        </td>
    </tr>
    
    <tr>
        <td>
        </td>
        <td>
            &nbsp;
        </td>
    </tr>
    
    <tr>
        <td>
            <input type=radio name="NotifyMethod" id="NRadio2" Value="Email" language=vbscript  AccessKey=E> 
        </td>
        <td>
            <Label class="Larger" for=NRadio2 language=vbscript >Send notifications by <u class=larger>E</u>-Mail.</Label>
        </td>
    </tr>

    <tr>
        <td>
        </td>
        <td>
            &nbsp;
        </td>
    </tr>

    <tr>
        <td>
            <input type=radio name="NotifyMethod" id="NRadio3" value="Pager" language=vbscript oAccessKey=P>
        </td>
        <td>
            <Label class="Larger" for=NRadio3 language=vbscript >Send notifications by <u class=larger>P</u>ager.</Label>
        </td>
    </tr>

    <tr>
        <td>
        </td>
        <td>
            &nbsp;
        </td>
    </tr>

    <tr>
        <td>
            <input type=radio name="NotifyMethod" id="NRadio4" value="Text" language=vbscript AccessKey=T>
        </td>
        <td>
            <Label class="Larger" for=NRadio4 language=vbscript >Send notifications by <u class=larger>T</u>ext message.</Label>
        </td>
    </tr>

    <tr>
        <td>
        </td>
        <td>
            &nbsp;
        </td>
    </tr>
   
</table>

 <label class=ErrMsg id=NoNotifyFile>Notification list not found!</label></Body>
    <Initialization><![CDATA[InitializeNotifications]]></Initialization>
  </Pane>
</Wizard>



Now, like MDT 2010, we need our initialization code.  In the Scripts directory of the deployment share, create a file called DeployWiz_Notify.vbs with the following contents:
' // ***************************************************************************
' // 
' // Copyright (c) Microsoft Corporation.  All rights reserved.
' // 
' // Microsoft Deployment Toolkit Solution Accelerator
' //
' // File:      DeployWiz_Initialization.vbs
' // 
' // Version:   6.0.2223.0
' // 
' // Purpose:   Main Client Deployment Wizard Initialization routines
' // 
' // ***************************************************************************

Function InitializeNotifications
    
    Dim oXML
    Dim sUser
    Dim sXMLFile
    Dim sEmail
    Dim sPager
    Dim sText
    Dim RootNode
    Dim SubNode
    Dim Attribute
    Dim ChildNode
    
    Set oXML = CreateObject("Microsoft.XMLDOM")
    oXML.async = false
    sUser = Ucase(property("UserID"))
    sXMLFile = Property("DeployRoot") & "\Control\NotifyList.xml"
    
    sEmail = "None"
    sPager = "None"
    sText = "None"
    
    if not oXML.load (sXMLFile) Then
        NoNotifyFile.style.display = "inline"
        NRadio2.Disabled = True
        NRadio3.Disabled = True
        NRadio4.Disabled = True
        Exit Function
    Else
        NoNotifyFile.style.display = "none"
    end If
    
    Set RootNode = oXML.selectNodes("//address[@UserID='" & UCase(sUser) & "']")
    
    If RootNode.length = 0 Then
        NRadio2.Disabled = True
        NRadio3.Disabled = True
        NRadio4.Disabled = True
    Else
        For Each SubNode In RootNode
            For Each Attribute In SubNode.attributes
                If LCase(sUser) = LCase(Attribute.text) Then
                    For Each ChildNode In SubNode.childNodes
                        Select Case ChildNode.nodeName
                            Case "email"
                                sEmail = ChildNode.text
                            Case "pager"
                                sPager = ChildNode.text
                            Case "text"
                                sText = ChildNode.text
                        End Select
                    Next
                End If
            Next
        Next
    End If

    If sEmail <> "None" And InStr(sEmail, "@") Then
        NRadio2.Disabled = False
    Else
        NRadio2.Disabled = True
    End If
    If sPager <> "None" And InStr(sPager, "@") Then
        NRadio3.Disabled = False
    Else
        NRadio3.Disabled = True
    End If
    If sText <> "None" And InStr(sText, "@") Then
        NRadio4.Disabled = False
    Else
        NRadio4.Disabled = True
    End If
    
End Function



This is the same function we used in MDT 2010 for the initialization code, but in 2012, it is in its own file instead of being added to DeployWiz_Initialization.vbs.

The final step is to tell the wizard to display our pane.  That is done by opening DeployWiz_Definition.xml from the Scripts folder of the deployment share.  Each pane is listed, so determine where you want your pane displayed and add the following:
<Pane id="Notify" reference="DeployWiz_Notify.xml">
  <!--Custom Task Sequence Pane-->
  <Condition>UCase(Property("SkipNotify"))<>"YES"</Condition>
  <Condition>FindTaskSequenceStep("//step[@name='Send Notification']", "ZTINotify.wsf" )</Condition>
</Pane>

This uses the same conditions as our 2010 pane, so it will display as long as there is a step in the task sequence called “Send Notification” calling the ZTINotify.wsf script and the property SkipNotifications is not set to YES.


Loading
Send feedback