Automate Your Lab – Part 9 – MDT With Chocolatey Integration

Table Of Contents

As you may have noticed while reading this blogseries I like the idea of automation. It is possible to automate nearly everything in Windows with PowerShell but when it comes to automate the deployment of Windows itself you are tied to some other tools. There a are a plenty out there: Microsoft System Center Configuration Manager, RES, AppSense, Empirum from Matrix42 and so on. They’re probably good tools for a production environment but not for a lab: To complicated, to slow, to big. For my lab I prefer Microsoft Deployment Toolkit (MDT), it is very lightweight and it is fast – particularly when you compare it to its big brother Configuration Manager. In this post I describe how to automate the installation of MDT and Windows Deployment Services (WDS) to do PXE boot. On top there is a description on how to integrate Chocolatey into MDT.

As always in this series you have to set some variables:

ADKDownloadURLMDT needs the Windows ADK. With this variable you define the URL where to get the ADK.
ADKOfflinePathAlternatively, it is possible to specify a path to a already downloaded Windows ADK. I use this at home because I just have a 2MBit Internet link 🙁
MDTDeploymentShareFolderDefines the path to the MDT Deploymentshare. This is the folder were all your apps and wim files are stored. I prefer to not use the C:\ drive as this folder can get very large. The script will create the folder for you.
MDTDeploymentShareNameThe name of the share of your MDT Deploymentshare which you defined with the variable MDTDeploymentShare.
MDTDownloadURLThis is the URL where to get the MDT setup. As it is a small setup there is no offline alternative.
MDTChocolateyApplicationsArray of Chocolatey packages. Each element will get a MDT application. Read below for more information on the Chocolatey integration.
WDSRemoteInstallFolderPath where the WDS boot images will be stored.

In my lab I use Chocolatey for installing apps. Chocolatey is a package manager for Windows like apt-get for Linux. Eric from did a great job on explaining it in detail here, here and here. To safe me a lot of work I use the Chocolatey wrapper from Keith Gartner. This wrapper checks if Chocolatey is already installed befor installing a package and if not, it installs Chocolatey. I tried to get in contact with Keith on Twitter to ask him if I am allowed to automate the usage of his wrapper, but he didn’t reply. So you have to do some manual steps:

  1. Download the wrapper from here
  2. Copy the Install-Chocolatey.ps1 to the scripts folder in your MDT deployment share ($MDTDeploymentShareFolder\scripts)

After the script has finished you have a complete MDT implementation with PXE boot for your targets, boot images already configured and some chocolatey apps to work with.



2 thoughts on “Automate Your Lab – Part 9 – MDT With Chocolatey Integration

Leave a Reply

Your email address will not be published. Required fields are marked *