Over the years it’s been relatively common to include Microsoft DaRT into your boot image used for OSD in ConfigMgr and several blog posts have explained the process with a step-by-step approach. Some time back I found myself integrating DaRT a little bit more than I would allow myself for manually going through those guides, hence here’s the PowerShell way of doing all of this. This post will not cover any of the benefits of doing this integration, it’s merely a way of contributing the script that I put together that has been published in our SCConfigMgr github repository for some time now.
Before you run the script, there’s a few requirements that needs to be in place for it to fully function. Below is a list of what you’d need to have installed on your Primary Site server:
- Microsoft MDT
- Microsoft DaRT
- Windows ADK
Usually, the Primary Site server would be a suitable server for all of these components to be installed, however if you decide to run the script against my recommendations, ensure these requirements are installed before attempting to run the script.
You can find the script in our SCConfigMgr github repository:
Running this script successfully, requires a couple of parameter input. Below is a list of the parameters and their usage:
- Required: Specify the name of the Primary Site server, required for locating the boot image information (if the SMS Provider role is located on another server than your Primary Site server, specify that server name instead)
- Required: Package ID property of the boot image where DaRT should integrated, e.g. P01000AB (also known as the Image ID in the ConfigMgr console)
- Required: Specify a temporary empty folder where the boot image can be mounted for adding the DaRT components
- Optional: When added to the command line, the script will attempt to update the distribution points where the boot image is distributed to
When executing the script, it will first attempt to locate the Windows ADK installation path from the registry on the local system. Once located, it will attempt to find the Microsoft MDT installation path, also by querying the registry. Next, the Microsoft DaRT installation path is queried. All of these three installations path locations are key for the functionality of the script, if any of them can’t be located due to one of the components are not installed, the script will fail.
After this the specified boot image will attempted to be located through the SMS Provider and backed up. The boot image will then be mounted to the temporary location specified as parameter input and DaRT components expanded into the mounted boot image. Additionally, another required DaRT file named DaRTConfig.dat will be added into the mounted boot image.
At the end if all of the above was successful, the script will dismount and commit all changes made to the boot image.
The script will make above mentioned changes to the original boot image file specified in the Image Path property of the Data Source tab. This will allow for future re-distribution actions without having to re-run this script.
Using the script
For demonstrating how the script works, I’ve imported a test boot image named ‘Boot Image with DaRT’. As you can see from my ConfigMgr console below, the Image ID (also known as the Package ID) is shown as P0100131.
With this information at hand, open an elevated PowerShell console and run the following command (obviously passing along the information that suits your environment):
.\Add-CMBootImageDaRTComponent.ps1 -SiteServer CM01 -PackageID P0100131 -MountPath C:\Temp\Mount -Verbose
Once the script has successfully completed, the output should resemble the following:
The next time that you initiate an operating system deployment for a device using this boot image, you’re able to utilize any method to automatically start DaRT.
Chief Technical Architect and Enterprise Mobility MVP since 2016. Nickolaj has been in the IT industry for the past 10 years specializing in Enterprise Mobility and Security, Windows devices and deployments including automation. Awarded as PowerShell Hero in 2015 by the community for his script and tools contributions. Creator of ConfigMgr Prerequisites Tool, ConfigMgr OSD FrontEnd, ConfigMgr WebService to name a few. Frequent speaker at conferences and user groups.