Some time last year, I wrote a blog post on how I moved away from traditional driver management with Configuration Manager, into a more ‘modern’ approach using regular packages.
- Find this post here: Almost Modern Driver Management with ConfigMgr and Powershell
Then a few days ago, I stumbled upon a twitter conversation with some very clever people, mentioning how they compressed some of their deployments of huge application into .zip files. The conversation moved on, and some more clever people mentioned the idea of compressing the binaries with WIM.
- Find the entire twitter conversation here: https://twitter.com/acjuelich/status/1284327742062899200
That got me intrigued, so I wanted to explore that option on my own. The result is obviously this blog post. 🙂
P.S. For good measures and all: Compressing binaries with WIM to use with ConfigMgr was not my idea nor invention. This is just me exploring, learning and sharing that experience with anyone who’s interested.
Quick look into the past
Not too long ago, I did this to my environment; I deleted each and every driver and driver package that existed within ConfigMgr.
Instead I moved into regular packages and never looked back. Everything is explained in details in the post I reference above.
Moving into WIM
First step in this new journey, is to compress your driver binaries into WIM. Most people will already have the driver binaries logically sorted somewhere, so this is the easy part.
Below is an example, where I have exported all the drivers used by a Lenovo ThinkPad X1 Yoga 4th. You will have something similar I assume.
This is the dism.exe command I used specifically for the directory shown above:
- NOTE: /Compress:max is up to debate and you might be better off skipping that, if you are using deduplication. People more clever than me, can elaborate on that topic.
dism.exe /Capture-Image /ImageFile:D:\Pkgsource\_MAB\Yoga4th.wim /CaptureDir:"D:\Pkgsource\_MAB\Yoga 4th" /Name:"ThinkPad Yoga 4th Drivers" /Description:"ThinkPad Yoga 4th Drivers" /Compress:max
The dism-command running will yield a result similar to below example:
The final .wim file will be similar to my example below:
A quick before and after comparison of the compression with WIM. The disk space savings are quite significant if you ask me. 🙂
Packages and Task Sequences
So how do I use all of this witchcraft in my own environment?
- NOTE: I’ve chosen to take on the most simple approach I could think of. You can add whatever complexity is required, in order for proper error handling and more. For now this is just telling the ‘Drivers as WIM’-story.
The newly created .wim file is used with regular packages as well. Everything standard ConfigMgr. Below an example of packages containing one .wim file each. No program is needed.
The main Task Sequence is referencing a nested task sequence.
Note that, this is still in WinPE and thus BEFORE Setup Windows and Configuration Manager.
Nested Task Sequence
The nested task sequence is the interesting part, so this paragraph is broken down in each step.
Create Driver Directory
This step is simply creating the directory, to where we are going to mount the .wim content. I create the directory within the task sequence cache directory.
cmd.exe /c md %_SMSTSMDataPath%\Drivers
This step is just a new group, making sure the sub-steps is only carried out by Lenovo hardware.
SELECT * FROM Win32_ComputerSystemProduct WHERE Version = "ThinkPad T470S"
Mount WIM X1 Yoga 4th Drivers
This step is mounting the .wim file, and makes the content available in the directory we created in the first step.
dism.exe /mount-wim /wimfile:Yoga4th.wim /index:1 /mountdir:%_SMSTSMDataPath%\Drivers
Another group, making sure that the sub-steps is only carried out if the drivers folder exists.
Apply Drivers Using DISM
This is where the drivers in the mounted WIM are being injected into the offline image. Delicious.
DISM.exe /Image:%OSDTargetSystemDrive%\ /Add-Driver /Driver:%_SMSTSMDataPath%\Drivers /Recurse /logpath:%_SMSTSMDataPath%\Drivers\dism.log
Unmount the WIM yet again and discard whatever is left. The drivers are no longer needed and this basically cleans itself up.
dism.exe /unmount-wim /mountdir:%_SMSTSMDataPath%\Drivers /discard
This will speed up OSD quite a bit, as well as save you some space on your hard drives.
Also, ZIP needs to be extracted. WIM does not. WIM only needs to be mounted. This means less space needed and less work in order to clean up.