News and Updates
- An important update for Microsoft Deployment Toolkit (MDT_KB4564442) has been released. This update fixes a boot loop issue. Download the update here.
In this article as with my previous ones we will walk through configuring Microsoft Deployment Toolkit to deploy the reference image created in the previous article: Build and Capture Windows 10 21H2 Reference Image
Installing the MDT Update: MDT_KB4564442
Extract the files from the self-extracting archive and copy them to %ProgramFiles%\Microsoft Deployment Toolkit\Templates\Distribution\Tools replacing the existing files. If you have existing shares you will need to copy the files from the update to %DeployRoot%\Tools and overwrite the existing files in all shares. You will then need to update the deployment shares and recreate boot media.
Creating the Deployment Share
- Open the Deployment Workbench from the Start Menu.
- Right click on Deployment Shares.
- Select New Deployment Share.
- Enter the path for the Deployment Share: E:\Deploy.
- Enter the Share name: Deploy$.
- Give the share a description.
- On the Options screen, accept the defaults as we can change them later.
- Complete the wizard to create the share.
- By default, the share permissions are set the local administrators group. We’ll revisit this later.
Add an Operating System
- Go to Deployment Workbench > Operating Systems.
- Right click and select Import Operating System.
- In the wizard, select Custom image file and then navigate to the Captures folder of the Build Deployment Share as the Source file.
- When prompted to Specify operating system setup files, select Setup files are not needed.
- For the destination directory name enter a name that you want to use and complete the wizard.
- Go to the Operating Systems node and rename the reference image we just captured to something more readable.
Create a Task Sequence
- In Deployment Workbench, go to Task Sequences.
- Right click and select New Task Sequence.
- For the ID enter: W10-21H2
- Name it Deploy Windows 10 21H2.
- Select Standard Client Task Sequence.
- For the Operating System, select the custom image that we imported previously.
- Select Do not specify a product key at this time if you are using KMS.
- Enter an Organization name.
- Enter the local Administrator password.
- Complete the wizard.
Now we’ll configure the Task Sequence.
Configuring the Task Sequence
- Right click on the Task Sequence just created and select Properties.
- Expand the Initialization folder in the left-hand pane.
- Go to the Gather local only item.
- In the Properties window select Gather local data and process rules.
- Enter the following in the Rules file: customsettings.ini
- Go to the State Restore folder and select Windows Update (Pre-Application Installation).
- On the right side of the Properties window, go to the Options tab.
- Uncheck the Disable this step tick box and do the same with Windows Update (Post-Application Installation).
- Select the Install Applications item and check the Disable this step tick box.
- Click Apply and close the Task Sequence.
Securing the Deployment Share
In the previous post we created a user called mdt_admin in Active Directory to be used as a service account. We must give that user access to the new deployment share we have created here.
- Go to the server or PC where the Deployment Share is hosted.
- Give the user mdt_admin Full Control share permissions and Full Control permissions to all the files and folders in the Deployment Share.
- You may also want to give similar permissions to users or groups that are going to be using the deployment share.
Next, we need to configure the Bootstrap.ini and the CustomSettings.ini files to control certain aspects of the deployment environment. The settings below are a bare minimum configuration from my lab, and you may want to add more to overtime.
- In Deployment Workbench, right click the Deployment Share and select Properties.
- Select the Rules tab and click the Edit Bootstrap.ini button.
- Add the settings below to the Bootstrap.ini.
- Close and Save the Bootstrap.ini
The settings below deserve some explanation. The [Virtual Machine] section is regarding driver installs which we’ll cover more later in this post. The Join Domain section is important. Here I’ve put the mdt_admin account to use as the account to join the device being imaged to the domain contoso.com. If you are following this guide to the letter, the mdt_admin account would not have the appropriate permissions to join a device to a domain, and so you should either give it the permissions required or create a new account for that specific purpose.
The other settings are location preferences relevant to the UK and resolution settings which prevent the finished device from defaulting to a resolution of 1024 x 768, and instead use the recommended resolution Windows receives from the display.
On the Rules tab of the Deployment Share properties window, add the settings below.
We now need to create the boot media to boot the VM into the deployment environment.
Creating the Boot Media
- In Deployment Workbench, right click on the Deployment Share.
- Select Update Deployment Share.
- Select Completely regenerate the boot images.
- Complete the wizard. It will take some time to create the boot images.
Testing the Task Sequence
To test everything, we need to copy the ISO file that we just generated. It is in the Boot folder in the Deployment Share. Go to the Server or PC that is hosting the deployment share and navigate to the boot folder. Inside there should be a file named LiteTouchPE_x64.iso. Copy this file to a location where a Hyper-V Virtual Machine will be able to access it. To prevent confusion with the ISO we generated from the Build deployment share, we’ll append -deploy to the name of this new ISO. Create a new VM in Hyper-V with the following configuration:
- For Hyper-V Only: Generation 1, not 2. I’ve had issues reported with Gen2 VMs
- At least 2x vCPUs
- At least 4GB of RAM
- Network Adaptor with access the local network.
- Virtual Hard Drive of at least 40GB, preferably on fast media.
- Boot from CD using the LiteTouchPE_x64-deploy.iso from MDT.
- If using Hyper-V on Windows 10 1709 or above, make sure Use Automatic Checkpoints is disabled.
Start the VM and it will boot from the LiteTouchPE_x64-deploy.iso into the deployment environment, you will be presented with a login screen and here you should login with the Active Directory credentials that have access to the Deployment Share. Once logged in you will be presented with a screen with the name of the Task Sequence you created earlier. Select your Task Sequence and click Next. You’ll be prompted to enter a name for the device, it will also be added to Active Directory under this name. Click Next and the task sequence will begin.
When the task sequence completes the VM will be shutdown.
This completes the basic testing of the deployment task sequence. Now we’ll get into drivers and further configuration.
Setting the Default Application Associations
Here’s how to configure the default application associations in the deployment task sequence.
- Using an existing Windows 10 install navigate to Settings > System > Default apps.
- Set the Default apps and any other file associations as required.
- Open Windows PowerShell (Admin) by right-clicking on the Windows/Start button or pressing Win + X.
- In the PowerShell window type the following and press enter:
Dism /Online /Export-DefaultAppAssociations:C:\AppAssoc.xml
- After a few seconds you should see The operation completed successfully in the PowerShell window.
- Navigate to C:\ and copy AppAssoc.xml to your MDT deployment share: \\SERVER-NAME\Deploy$\_custom.
- Open the Deployment Workbench and go to Deployment Share > Task Sequences.
- Right click on the Task Sequence Deploy Windows 10 21H2 and select Properties.
- Click on the Task Sequence tab and navigate to Postinstall > Configure.
- Click the Add button at the top of the Task Sequence actions view and go to General > Run Command Line.
- Enter Set Default App Associations in the Name field, and in the Command line field enter: [code language=“text”]Dism.exe /Image:%OSDisk%\ /Import-DefaultAppAssociations:%DEPLOYROOT%\Applications\_scripts\AppAssoc.xml[/code]
- Click Apply to save the changes.
Now we’re going to configure how drivers are installed for the physical devices we’re going to deploy Windows 10 to. There are a few ways to do this, here I’ll show the ‘Total Control’ method I’ve been using more recently.
The first thing you’ll need is the manufacturer and model numbers for all the devices you want to roll out the image to. You can find this out by booting a device in to its current version of Windows or the WinPE deployment environment using the LiteTouch_x64.iso boot disc or PXE booting. Here’s a previous post I wrote on how to setup PXE booting for MDT if needed: PXE Booting for Microsoft Deployment Toolkit.
When the device is booted into the deployment environment, press F8 to get a command prompt, and typing out the following commands:
The output of the commands is the manufacturer name and model number you’ll need. The next thing you’ll need is the drivers. Windows 10 is good at installing missing drivers from Windows Update, but it can take some time and it would be better for the device to be running with all the drivers it needs once deployment has completed.
Most large manufacturers (Dell, HP, Lenovo) do a decent job of providing drivers that can be used with MDT. Should you have difficulty with them you can use the Microsoft Update Catalog to search for and download the specific drivers that Windows Update installs and use them with MDT. Once you have the drivers you require, we need to add them to MDT.
- Open the Deployment Workbench.
- Navigate to Deployment Share > Out-of-Box Drivers.
- Right click and select New Folder, name the folder The output of the Manufacturer.
- Right click on the Manufacturer folder and select New Folder.
- Name the folder the model of device we’ll be importing drivers for.
- Right click on the folder you just created and create folders for each driver type you’ll be adding, eg. Graphics, Chipset, Bluetooth. NOTE: This is just for tidyness and isn’t required for the drivers to be installed.
- Right click on a driver type folder and select Import Drivers.
- Enter the source directory of the drivers for that driver type.
- Check the Import drivers even if they are duplicates of an existing driver check box.
- Click Next and complete the wizard. The wizard will copy all the files needed to the driver type folder.
- Repeat steps 7-10 for each driver type required.
- Finally repeat the steps 3-11 for each manufacturer, and model required.
If you have many different manufacturers and models then this process can be quite tedious. I’ve created a PowerShell script to automate the process, it’s on my GitHub here. It requires some documentation which I will provide in a separate post.
We now need to edit the Deployment Task Sequence to configure the driver location.
- Go to the Deployment Workbench and Task Sequences, select the Deploy Windows 10 Task Sequence.
- Go to the Task Sequence tab in the Properties window.
- Navigate to Preinstall and then select Enable Bitlocker (Offline), then go to the Add menu, General and select Set Task Sequence Variable.
- You should have a new blank Set Task Sequence Variable below Enable Bitlocker (Offline).
- Rename the blank Set Task Sequence Variable to Set DriverGroup.
- In the Properties panel enter the following for Task Sequence Variable:
- In the Properties panel enter the following for Value:
- Now go down and select Inject Drivers.
- In the Properties panel change the Choose a selection profile dropdown to
- Select the Install all drivers from the selection profile.
- Click on Apply to save the changes and OK to close the Task Sequence.
The Task Sequence is now configured to install drivers for any device that has drivers in the correct folder structure under Out-of-Box Drivers.
Boot the physical device into the deployment environment and run the Deploy Windows 10 21h2. After it completes, check Device Manager and all devices should be successfully installed.
Adding Drivers to the MDT Boot Image
It may be necessary to add drivers to the MDT Boot Image for devices such as storage or network adaptors. To determine if drivers are required:
- Boot the device in question into the deployment environment and press F8 to bring up a command prompt.
- Type ipconfig and if you have an IP address, you should not have to add network adaptor drivers
- Type diskpart, and when diskpart has loaded, type list disk. If the local hard drive is listed, you should not need to add storage drivers.
If you do need to add drivers to the boot image:
- In the Deployment Workbench, go to Deployment Share > Out-of-Box Drivers.
- Right click and select New Folder, call the folder WinPE x64.
- Right click on the WinPE x64 folder and select New Folder.
- Name the folder a suitable name for the manufacter of device you’ll be adding drivers for, and then create another folder inside for the model of the device.
- Right click on the model folder you just created and create folders for each driver type you’ll be adding, eg. Storage, Network.
- To import the drivers, right click on a driver type folder and select Import Drivers.
- Enter the source directory of the drivers and tick the Import drivers even if they are duplicates of an existing driver check box.
- Click Next and complete the wizard. The wizard will copy all the files needed to the driver type folder.
- Repeat steps 6-8 for each driver type required.
- Now we must create a Selection Profile for WinPE x64.
- Go to Advanced Configuration then Selection Profiles.
- Right click on Selection Profiles and select New Selection Profile.
- Enter WinPE x64 as the Selection profile name.
- In the folders list navigate to DS001:\ > Out-of-Box Drivers > WinPE x64 and check the box next to the folder.
- Click Next > Next > Finish to complete the wizard.
- Right click on the Deployment Share and select Properties.
- Go to the Windows PE tab and change the Platform drop down menu to x64.
- Go to the Drivers and Patches tab and change the Selection profile drop down menu to WinPE x64.
- Make sure that Include only drivers of the following types is selected and both Include all network drivers in the selection profile and Include all mass storage drivers in the selection profile are checked.
- Click Apply to save the changes, click OK to close the Properties window.
- Right click the Deployment Share and select Update Deployment Share.
- Select Completely regenerate the boot images, and then Next. The boot images will be regenerated with the drivers included.
- Click Finish to complete the wizard.
The MDT boot media should now have the network and/or storage drivers required. You now have a reference image for Windows 10 21H2 which is ready to deploy.
Support My Work
Please consider supporting my work: