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.
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)
Add a step in the TaskSequence.
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)
Add a step in the Task Sequence like this.
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/
/mike
Categories: ConfigMgr, Deployment, Lite Touch, MDT, OS Deployment, OSD, SCCM, Zero Touch
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.
No, it does not. You need to setup the SMTP name, service and ip to fit your existing environment for this to work.
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?
Nevermind, putting the breaks worked :)
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
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.
It is possible, however you need to find about a way for identification during deployment
Which smtp server should I use?
Take a pick, any that works.
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?
Great idea, i’ll fix that!
I tried to add a call to this script in lticleanup but was never able to get it working (but I did get it to include the errors and warnings from the bdd file). If it did I would be so happy!
using sccm CB1606: all $tsenv vars are not resolved in the smsts.log, result: the step returns SMTP host not specified
It should work, check the bdd.log
Will this work for sccm integrated with mdt as well?
Yes!
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]
…
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]
…