About Microsoft Deployment Toolkit
The Microsoft Deployment Toolkit (MDT) can help build an automated installation source for deploying Windows OS and Office. The build can also include device drivers, Windows updates, and any other software.
The ZENworks Agent is one such software that needs to be installed during deployment.
Now, let me explain the way the ZENworks agent installation is carried out in the problem statement.
About ZENworks Agent Installation
ZENworks Agent can be installed through an executable (PreAgentPkg_Agent[Complete|CompleteDotNet].exe) available on ZENworks Primary in the zone. This PreAgent package contains various individual packages that comprises the Agent. The ZENworks agent can be installed by running this PreAgent package with the following options. There are other command line parameters than listed below. Use the PreAgentPkg_Agent.exe -h option to list all the available options.
-x = suppress reboot (Manual Reboot)
-q = show no reboot prompt(quiet install)
-m = rebootless agent with limited agent
Executing PreAgent will extract the packages & create a pre agent service to track the agent installation. The PreAgent executable now exists leaving the service for tracking of individual packages required for the agent.
The ZENworks PreAgent exists after the initial tasks and doesn’t wait till the installation of the individual packages. The MDT deployment will move on to the next installation in the build, thinking that the installation of ZENworks Agent is finished. This can lead to installation failure as there can be only be one installation (one instance of msiexec) is allowed in Windows at a given time.
We wrap this installer in a PowerShell script, which will be running & tracking the agent installation until it finishes.
The MDT build can now be configured to run this script instead of the PreAgent package. This script will make sure that we don’t return the control to MDT while the agent installation is in progress & thus sequencing the next installations from the MDT build.
How the Script Works
This script will track the status file ZPA.status that gets created, updated with every activity of PreAgent, individual package installation and reboot behavior post installation. This is a more reliable way to track the agent installation.
The script is available ZENworks PreAgent Tracker in zip format. Please feel free to tune the script for different command options, configure script timeout, and more.
Hope this helps.