I am working on rewriting our Linux imaging script to Powershell so we can move to WinPE imaging. We are on ZENworks Update 2a running Linux on our primary and satellite servers. I know we need to build out Windows imaging servers to fully move to WinPE imaging but I was asked to look into it. So I have been reading through the documentation which explains how to restore an image by proxy or local device using a command such as img -rl D:/1709.wim. I have been taking and making images to a USB drive as proof of concept. However I am unable to find how to script restoring an add-on image. We support about 50 different models and our Linux script would query the device for the model and use an "if, elseif" statement listing the models and what driver pack each should get. When capturing an image with Linux it would get all 4 GPT partitions so we would then build driver packs to install files to the appropriate partition and folder path. So the add-on image could be restored like our base image. However, using WinPE to take an image, it captures the system partition and the Primary (C:\) partition so the actual image is on index 2. If I copy just the C partition the computer will not boot, so I need to capture both the system and C partition. The driver pack is created using the following command: dism /capture-image /imagefile:C:\data\LatitudeE5440-10.wim /Capturedir:"C:\Windows\DVUSD\Drivers" /Name:"Latitude E5440-10" which saves the data to index 1. Since this is the 99 MB system partition, I need to restore it as an add-on image setting the file path to: C:\Windows\DVUSD\Drivers in WinPE maintenance mode (using zenworktodo.exe) and it installs fine. So that's why I'm asking if there is a script to restore an add-on like how it is manually done with the WinPE maintenance mode.

The add-on option in the third party imaging bundle would work once we build a Windows sever but we would need to make a bundle for every model. So it is doable but not efficient. I am able to manually apply an add-on bundle from a flash drive which is fine in a testing environment but not practical in our production environment.

Here is part of our Linux script to show how we call an add-on image:
echo "Detecting Model and Driver Package"

model=`dmidecode|grep Product|head -1|uniq|sed 's/ //g'|sed 's/[ \t]//g'|sed -r 's/^ProductName://g'`
unset drivers

if [[ $model == "OptiPlex7010" ]];then
drivers='Optiplex7010-10'
elif [[ $model == "OptiPlex7020" ]];then
drivers='Optiplex7020-10'
elif [[ $model == "OptiPlex5040" ]];then
drivers='Optiplex5040-10'
...

echo "Loading Image"
img rp $IMGSVR 1709r0.zmg

if [ $drivers ]; then
img rp $IMGSVR $drivers.zmg


This logic has been converted to a Powershell script and works fine but due to the index of the base image being 2 and the driver pack being 1 and then needing to define where the image installs to, I don't know how to script this. Is there something I missed in the documentation or how have you handled multiple driver packs using WinPE imaging?