MDT – Check if the model is certified, with mail flow.

Hey Again! Long time no seen, just had an amazing vacation. How are you guys?
Now with some new pieces of stuff that I´ve been working on.

In our company, we have a lot of different models, and sometimes they deploy them without me knowing. And therefore I didn’t put in any drivers.


  • A pop-up box prompt while deploying a machine in MDT (this could work in SCCM also, not tested), So the installation doesn’t continue
  • A mail with the model name, computer name, and deployment share name, So i can put the correct model drivers into the MDT workbench.


I made a PowerShell script that solves this. You need to fill the parameters to make it work in your environment.

Like this2018-08-13 14_01_16-Administrator_ Windows PowerShell.png
.\ComputerNotCertfied.ps1 -SMTPServer -SMTPPort 25 -From -To

Little explanation of the parameters
-SMTPServer (To send an email without putting any credentials, I’m I using a SMTP relay)
-SMTPPort (And I need to specify the ports as well for the relay)
-From (From which address I want to specify )
-To (To which address I want to specify)

#    ComputerNotCertfied.ps1
#Make a step in MDT, and a popup will promt the user, that the "Computer is not certified, #a mail have been sent to the system administrator"
#Then the script is sending a email to the system-admins.
#And after that, Shuts down the computer.

#Created: 2018-08-13
##Version: 1.0

#Author : Pontus Wendt
#Twitter: @pontuswendt
#Blog   :

#Disclaimer: This script is provided "AS IS" with no warranties, confers no rights and
#is not supported by the author
#ComputerNotCertfied.ps1 -SMTPServer -SMTPPort 25 -From -to

[parameter(mandatory = $True, HelpMessage = "Name of the SMTP server?")]

[parameter(mandatory = $True, HelpMessage = "Name of the SMTP relay port?")]
[parameter(mandatory = $True, HelpMessage = "Which adress are you sending from?")]
[parameter(mandatory = $True, HelpMessage = "Which adress are you sending to?")]
$wshell = New-Object -ComObject Wscript.Shell
$wshell.Popup("Computer is not certified, a mail have been sent to the system administrator.", 0, "Error", 0x0 + 0x1000)

#Gather computer information
$log = get-content "C:\MININT\SMSOSD\OSDLOGS\BDD.log"
foreach ($line in $log) {
    if ($line -like "*DeployRoot is now =*") {
        $Deploymentshare = "Deploymentshare " + "$($line.split("=")[1].split(']')[0])"

$Model = wmic computersystem get model
$Make = wmic computersystem get manufacturer

#Send mail with gathered information
$Subject = "New Model to certify"
$Body = "$Model `n $Make `n $Computername `n $Deploymentshare"
Send-MailMessage -From $From -to $To -Subject $Subject -Body $Body -SmtpServer $SMTPServer -port $SMTPPort

#Shutting down computer


  1. Copy this script (  zip it up first 😉 ) into the script folder in your Deployment share.
  2. Make a new step in your MDT task sequence, Choose PowershellScript
    2018-08-13 14_39_30-Photos.png
  3. Put this script into an MDT Step, and specify the parameters you want to use.
    PowerShell script: ComputerNotCertified.ps1
    Parameters: -SMTPServer -SMTPPort 25 -From -To
    2018-08-13 14_41_04-sql.invidjkp.local - ASG-RemoteDesktop 2018 - invjkp-mdt01.png
  4.  Go to Options tab and click on Add button.
  5. Add then “If statement“, then choose “none
    2018-08-13 14_45_15-sql.invidjkp.local - ASG-RemoteDesktop 2018 - invjkp-mdt01.png
    2018-08-13 14_45_56-sql.invidjkp.local - ASG-RemoteDesktop 2018 - invjkp-mdt01.png
  6. Mark “if none of the conditions are true, then Add Query WMI2018-08-13 14_47_14-sql.invidjkp.local - ASG-RemoteDesktop 2018 - invjkp-mdt01.png
  7. Now we need to specify the models that are already certified.
    (Put in following text (in this example I put in the Virtual machine, in your case it could be “HP 820 G3”:
    SELECT * FROM Win32_ComputerSystem WHERE Model Like “Virtual Machine”
    2018-08-13 14_49_56-sql.invidjkp.local - ASG-RemoteDesktop 2018 - invjkp-mdt01.png
    2018-08-13 14_55_06-sql.invidjkp.local - ASG-RemoteDesktop 2018 - invjkp-mdt01.png
  8. Click Ok, then Apply, close the Task Sequence.
  9. Then “Update Deployment Share”
  10. Done

How does it looks like when we run a computer that is not certified?

When the computer run the “Check If the computer is certified” step.
This will pop-up

When you click “Ok“, the computer stops and shuts down.

Then you check your mail inbox.
2018-08-13 14_57_44-mdt - Inkorg - mdt - Outlook.png

Voila! Now you got an email that they tried to run a un-certified model.

Thanks for reading


Leave a Reply

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

You are commenting using your 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