Have you ever thought about what actually happens when you import applications into your MDT environment? How does the task sequence know what application to install? How does it know what command-line arguments to specify during the application install process?
Technically, as a user, all that is required of us is to simply import the application, add an “Install Application” step in the task sequence, and select the appropriate application. But what actually happens during the deployment to get the application to install? Well, let’s take a peek behind the curtain to find out.
Firstly, let’s take a look at where the application information is stored after the app is imported into MDT. The applications.xml file contains the information of every application that exists in your MDT environment. So, essentially, if you can see it in your Deployment Workbench, then there is a corresponding entry in this XML file.
This file is located at %DeployRoot%\Control\Applications.xml and although we can easily view it in a browser, I want to show how we can explore the document using powershell. As you can see below, we can view the contents of the document by using the Select-Xml cmdlet. For this demo I decided to find a specific application using an XPath query.
Note: I will focus on fully explaining how to use XPath to query XML files for information in a later series of posts.
Secondly, I want to take a look at what application info is stored in the task sequence and how it communicates with the XML file during the deployment process. The image below shows what the task sequence(ts.xml) looks like after I added an “Install Application” step and selected “Install a single application”. You can see that only the application GUID gets stored in the task sequence.
So how does it get the application name and the command-line arguments? Take a look below.
Generally speaking, the ZTIApplications.wsf script will do three things. First it will get the application GUID from the task sequence and/or the customsettings.ini file (If you have specified multiple Mandatory Applications to be installed). Then it will parse the applications.xml file and find the application that corresponds to the GUID. Once the application is found, it can return the name and the command-line arguments to be used for the install process. Below is a snippet from the ZTIApplications.log file.
You can see that it was able to use the MalwareBytes GUID from the task sequence and find the corresponding entry in the XML file. Once that was taken care of, the easy part was to get the app name and commands to perform the install.