ZENworks WinPE Addon Script

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
elif [[ $model == "OptiPlex7020" ]];then
elif [[ $model == "OptiPlex5040" ]];then

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?
2 Replies
Absent Member.
Absent Member.

Re: ZENworks WinPE Addon Script


It appears that in the past few days you have not received a response to your
posting. That concerns us, and has triggered this automated reply.

These forums are peer-to-peer, best effort, volunteer run and that if your issue
is urgent or not getting a response, you might try one of the following options:

- Visit https://www.microfocus.com/support-and-services and search the knowledgebase and/or check
all the other self support options and support programs available.
- Open a service request: https://www.microfocus.com/support
- You could also try posting your message again. Make sure it is posted in the
correct newsgroup. (http://forums.microfocus.com)
- You might consider hiring a local partner to assist you.

Be sure to read the forum FAQ about what to expect in the way of responses:

Sometimes this automatic posting will alert someone that can respond.

If this is a reply to a duplicate posting or otherwise posted in error, please
ignore and accept our apologies and rest assured we will issue a stern reprimand
to our posting bot.

Good luck!

Your Micro Focus Forums Team


Re: ZENworks WinPE Addon Script

I needed to edit the partitions in the driver zmg file then specify what partitions to read and write to. This solved my problem:
img -restore -local $drivers -ap=a1:p3
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.