ConfigMgr

OSD–Using ZTISendMail to send email in a LTI/ZTI task sequence

Long time ago I had a need to send email an email in the end of the task sequence to notify the technician that the OS deployment was done, therefore creating a script which then ended up as a blog post at Deployment Research about two years ago. This week I’m running a Mastering Windows 7 and 8.1 OS Deployment using Lite Touch and Zero Touch in Minnesota and there where some requests on the subject so I decided to create a new version of the script and this time it is a PowerShell script instead. One of the request was to be able to send and email to the administrator that does the deployment (in Lite Touch) using the login name, so that need to to be taken under considerations to.

The script is tested in MDT 2013 but should work perfect in MDT 2012 Update 1 as well and it works when deploying Windows 8 and above.

Lite Touch

First you need to download the script and sample customsettings.ini  from here http://1drv.ms/1kvmobn and store the PowerShell it in the MDT Scripts folder.

Option Number One: Using the UserID directly

Update the CustomSettings like this. (you can copy and paste from the sample customsettings.ini files)

The name used to login to the LTI Wizard is defined as UserID and that is then used as a part of the email address to send it to.

image

Option Number Two: Using the UserID with translation.

In this case we create a section for every user account that should have an email an can logon. As an example, if you login as Administrator (don’t use that account!) an email would be sent to administartor@viamonstra.com, but you can have any other setting for that userID if you liketo.

Update the CustomSettings like this. (you can copy and paste from the sample customsettings.ini files)

image

Add a step in the TaskSequence.

image

Zero Touch

First you need to download the script and sample customsettings.ini  from here http://1drv.ms/1kvmobn and store the PowerShell it in the MDT Package Scripts folder.

In the ZTI we don’t really have a UserID and therefore we just send the email to a predefined email address and cc to an other.

Update the CustomSettings like this. (you can copy and paste from the sample customsettings.ini files)

image

Add a step in the Task Sequence like this.

image

Update the settings package and the MDT Package.

If you need a SMTP server to test against, read this https://deploymentbunny.com/2014/06/12/nice-to-knowa-simple-and-small-smtp-mailserver-fr-devlabtest-smtp4dev/

image

/mike

21 replies »

  1. I’m having an issue with the format of the email. It splits it correctly in the console, but will not do it for the email body. Everyone stays on one line. I tried adding in line breaks, but they seem to be ignored. Any ideas?

    • No, I have tested and it seems to work. It could be anything, including the application you use to read the mail, or settings in that app. You could try to send it as HTML?

      • Hi Mikael,

        Thanks for the great script. I have the same issue as Patrick tho’. Mail client (Outlook 2013) does not put in breaks and shows the ouput on one long line.
        Any ideas?

  2. Awesome script Mikael. The only comment I would make is that the prerequisite is to add the Windows PowerShell Feature to WinPE, update the deployment share and use the updated WinPE boot image. This caught me out on the first couple of builds until I realised why it was failing :-)

    Cheers,
    Jeremy

  3. Is there a way to send the email the account used by the technician to join the domain via the wizard using a variable such as %DomainAdmin%@contoso.com? Any help will be appreciated.

  4. Have you ever given any thought to adding this as a step in the lticleanup script, so no matter if its a success or a failure an email gets sent?

  5. using sccm CB1606: all $tsenv vars are not resolved in the smsts.log, result: the step returns SMTP host not specified

  6. In our CS.ini we use the %userid% and that user id is relative to a number ie: 15456 (different number for different tech who connect to DS) usefull to filter task sequence for all users
    [WINPE]
    WizardSelectionProfile=%UserID%

    Is there a way I could convert that so the UserID could correspond to the email of the tech, is this correct?

    [15456]
    OSDSendMailtoPri=tech1@domain.com

    [15457]
    OSDSendMailtoPri=tech2@domain.com

    [SendMail]

  7. In our CS.ini we use the %userid% and that user id is relative to a number ie: 15456 (different number for different tech who connect to DS) usefull to filter task sequence for all users
    [WINPE]
    WizardSelectionProfile=%UserID%

    Is there a way I could convert that so the UserID could correspond to the email of the tech, is this correct?

    [15456]
    OSDSendMailtoPri=tech1@domain.com

    [15457]
    OSDSendMailtoPri=tech2@domain.com

    [SendMail]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.