While more and more organizations are leaving the MDT integration in ConfigMgr behind – In favor of PowerShell driven community solutions, or by developing their own custom PowerShell scripts – There are still ConfigMgr environments using the integration.
While the default MDT package that is created by the MDT console extensions for ConfigMgr is working just fine, it's far from the most efficient package from a network point of view. Especially in HTTPS and/or P2P environments. In some scenarios I've seen download times well over ten minutes for this little package. Goods news is that you can improve this, and this process is not new per say. It even got its own name by the community: MDT Lite.
Credits: The concept of reducing the MDT package size to speed up the download was originally developed by Niall Brady, Gary Blok, and Gerry Hampson.
In this post you learn how to create three different MDT Lite packages:
- MDT Lite 8456 – Gather Only Package
- MDT Lite 8456 – All Features Package
- MDT Ultra-Lite 8456 – All Features Package (a.k.a. MDT Lite Super-Speed Edition)
The Default MDT Package
The default MDT package for MDT 8456 is 65 MB in size, and contains 653 files. Of these 653 files you only need between 6 to 30 files depending on what MDT features you are using with ConfigMgr, and what architecture (x86/x64) you support. So yes, there is certainly room for some cleanup.
MDT Lite 8456 – Gather Only Package
The most commonly used feature from the MDT integration is the Gather action. If you only use the Gather feature, you can create a tiny MDT Lite package. Here is a script that creates a MDT Lite package supporting only the Gather feature:
#
# Written by Johan Arwidmark, @jarwidmark on Twitter
#
# Global Settings
$SiteCode = "PS1"
$MDTInstallDir = (Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Deployment 4' -Name Install_Dir).Install_Dir
$ConfigMgrSources = "\\corp.viamonstra.com\fs1\Sources"
# Import the ConfigurationManager.psd1 module
if((Get-Module ConfigurationManager) -eq $null) {
Import-Module "$($ENV:SMS_ADMIN_UI_PATH)\..\ConfigurationManager.psd1"
}
# Connect to the site's drive if it is not already present
if((Get-PSDrive -Name $SiteCode -PSProvider CMSite -ErrorAction SilentlyContinue) -eq $null) {
New-PSDrive -Name $SiteCode -PSProvider CMSite -Root $ProviderMachineName
}
Set-Location C:
# Create the MDT Lite Package for Gather Only
$PackageName = "MDT Lite 8456 - Gather Only Package"
$PackageSource = "$ConfigMgrSources\OSD\MDT\MDT Lite 8456 - Gather Only Package"
# Create the package source folder structure
If (test-path $PackageSource){
Write-Warning "Package already exists, aborting..."
Break
}
Else{
New-Item -Path "$PackageSource\Scripts" -ItemType Directory -Force
New-Item -Path "$PackageSource\Scripts\x86" -ItemType Directory -Force # If you don't deploy x86, comment out this line.
New-Item -Path "$PackageSource\Scripts\x64" -ItemType Directory -Force
}
# List of the needed script files. Path is relevant to the MDT installation directory
$ScriptFiles = @(
"Templates\Distribution\Scripts\ZTIDataAccess.vbs"
"Templates\Distribution\Scripts\ZTIGather.wsf"
"Templates\Distribution\Scripts\ZTIGather.xml"
"Templates\Distribution\Scripts\ZTIUtility.vbs"
)
# Copy the script files
Foreach ($File in $ScriptFiles){
Copy-Item -Path "$MDTInstallDir\$File" "$PackageSource\Scripts"
}
# Copy files from the Tools folder
Copy-Item -Path "$MDTInstallDir\Templates\Distribution\Tools\x86\Microsoft.BDD.Utility.dll" "$PackageSource\Scripts\x86" # If you don't deploy x86, comment out this line.
Copy-Item -Path "$MDTInstallDir\Templates\Distribution\Tools\x64\Microsoft.BDD.Utility.dll" "$PackageSource\Scripts\x64"
# Copy-Item -Path "$MDTInstallDir\Templates\Distribution\Tools\x86\Serviceui.exe" "$PackageSource\Scripts\x64" # Not required, but very useful for troubleshooting
# Copy-Item -Path "$MDTInstallDir\Templates\Distribution\Tools\x64\Serviceui.exe" "$PackageSource\Scripts\x64" # Not required, but very useful for troubleshooting
# Create the MDT Lite package
Set-Location "$($SiteCode):\"
If ((Get-CMPackage -Name $PackageName -Fast | Measure-Object).Count -gt 0){
# Package already exist
Write-Warning "Package $PackageName already exists, aborting..."
Break
}
Else{
New-CMPackage -Name $PackageName -Path $PackageSource
}
MDT Lite 8456 – All Features Package
To support all the features in the MDT integration you need about 30 files from the MDT package. Come back for a script that creates the all features package.
Note: You can also putting the CustomSettings.ini file, and Unattend.xml template(s) in the MDT package. It's faster then having them in a separate package. Just don't forget to update your Gather actions and the Apply Operating System Image action if you do. By default they are configured to use a separate settings package.
MDT Ultra-Lite 8456 – All Features Package
If you don't mind modifying the ZTISCCM.wsf script a bit, you can actually make the MDT Lite package download even faster. Simply add all the needed MDT scripts to a CAB file, and add some code in the beginning of the ZTISCCM.wsf script that extracts the files to the package folder before running the rest of the code.
Using ServiceUI.exe to troubleshoot Task Sequence in full Windows
The ServiceUI.exe file that is used by the UDI Wizard is a fantastic tool to have for troubleshooting task sequences in full Windows. For example to do live debugging of scripts, or testing application installs. While not required for the Gather only package, I usually add it in just to have it available. For more info, see this post: Troubleshooting ConfigMgr Task Sequence Actions Using ServiceUI – Deployment Research
Great article, would be very interested in seeing more suggestions/techniques about how to speed MDT processes up!