As part of the MDT installation process, you need to run the “Configure ConfgMgr Integration” wizard to add the MDT components into the ConfigMgr console and database.  But what if you want to automate that process?  Fortunately, that’s pretty easy to do using PowerShell, as the integration process really just copies some files around.

See below for the attached PowerShell script, which performs the following tasks:

  • Locates the MDT installation directory.
  • Attempts to find the ConfigMgr 2007 console’s installation directory.  If found, copy files and folders from the MDT installation directory to that location.
  • Attempts to find the ConfigMgr 2012 console’s installation directory.  If found, copy files and folders from the MDT installation directory to that location.

So there’s not much to it.  Note that the wizard does a couple of additional tasks that aren’t covered by this script:

  • Add the MDT task sequence actions into the ConfigMgr database.  This is done by editing a MOF file to specify the site server name and site code, and then compiling that MOF.  This process just needs to be done once, generally at the top-level site only.  It’s easy enough to do this one-time operation manually (using an account that has full permissions to the site server), so no real need to automate it.
  • Remove the MDT extensions from an existing ConfigMgr console.  This is left as an exercise for the reader:  Instead of copying the files to the ConfigMgr console directory, you just need to remove them.

Make sure you run this script from an elevated PowerShell session, and also make sure that PowerShell scripting has been enabled using something like “set-executionpolicy bypass”.