The Deployment Bunny

OS Deployment, Virtualization, Microsoft based Infrastructure…

  • Archives

  • Meta

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

Posted by Mikael Nystrom on June 13, 2014

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

19 Responses to “OSD–Using ZTISendMail to send email in a LTI/ZTI task sequence”

  1. Alex said

    Does the account OSDeploymentservices@viamonstra.com actually exist or does it not matter for this? I’m trying to use this in an exchange environment using our own stmp server, but wondering if I need to create a real mail account first.

  2. Patrick said

    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?

      • Tony said

        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?

      • Tony said

        Nevermind, putting the breaks worked :)

  3. 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

  4. tgcit said

    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.

  5. Cor said

    Which smtp server should I use?

  6. Brian said

    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?

  7. BS said

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

  8. naits said

    Will this work for sccm integrated with mdt as well?

  9. […] após algumas pesquisas encontrei o ZTISentMail do Mikael Nystrom que você encontra nesse link. Então resolvi escrever um script PowerShell que tenha suporte a envio de e-mail usando smtp […]

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

 
%d bloggers like this: