The AppDeployment Toolkit Powershell script cannot be added as a Custom Action.
The reason for this is, that only single files can be added as a Custom Action. The App Deployment Toolkit Powershell Script consists of different files which cannot be used on its own but are highly dependent on each other, see below:
(Files and Folders of the AppDeployment Toolkit)
(Files of the AppDeployment Toolkit)
When using the Load from file… button in the NEW CUSTOM ACTION Wizard only the script from a single file can be added.
(File added using the “Load from file…” button)
As a workaround instead of a custom action, an executable can be used. Select the Executable on destination to add the AppDeployment Toolkit.
When using this option the sources also need to be installed or they need to be present on the target device.
(Executable on destination option that can be used as workaround)
With this option, either Powershell.exe (with the necessary arguments) or Deploy-Application.exe should be started.
Using the AppDeployment Toolkit to Install a Dependency for the Main Application
Best practice would be to split the packages and use a Deployment tool (SCCM/RMS) to install the dependency. Furthermore, there are some limitations when running such an installation inside of an MSI. For example, another MSI that is located inside of the MSI cannot be installed while running the installation of the main MSI.
If the AppDeployment Toolkit should nonetheless be used to install some setup.exe, the steps below can be used to create a working MSI package.
1. Open the RPP/MSI.
2. Add the whole content of the AppDeployment Toolkit to the package.
3. Create a Custom Action of the type Executable.
4. Select Executable on Destination.
5. Set the folder where the AppDeployment Toolkit is located as working directory.
6. The full path to the location of the Deploy-Application.exe needs to be set as command line:
"C:\Program Files (x86)\WinSCP\Package\Deploy-Application.exe" -DeploymentType "Install" -DeployMode "Silent"
It is also possible to use the identifier of the folder:
"[Package]Deploy-Application.exe" -DeploymentType "Install" -DeployMode "Silent"
or
"[#DeployApplication.exe]" -DeploymentType "Install" -DeployMode "Silent"
The last one is recommeded because it uses the file.
7. The Custom Action needs to be run in the deferred mode and after the InstallFiles action.
8. Because the action is using files, a condition that the action only runs on installation needs to be set.
(Not installed)
9. If the AppDeployment Toolkit should be removed afterwards, a second Custom Action is needed. This Custom Action needs to run before the RemoveFiles action.
(Custom Action using AppDeployment Toolkit)
Comments