PowerShell Script Template Files
AdminStudio 2025 R2 | 30.0 | Application Manager
A PowerShell script template file for Deploy-Application.ps1 (PSADT v3) and Invoke-AppDeployToolkit.ps1 (PSADT v4), is provided in the following location:
• | PSADT v3— C:\AdminStudio Shared\PowerShellTemplate\ |
• | PSADT v4— C:\AdminStudio Shared\PSAppDeployToolkit_Template\ |
You can customize this script to meet your deployment requirements by editing it in the Windows PowerShell ISE application.
This script is provided as a template to perform an install or uninstall of an application(s). The script either performs an “install” deployment type or an “uninstall” deployment type. The install deployment type is broken down into three main sections: Pre-Install, Install, and Post-Install. The script refers to the AppDeployToolkitMain.ps1 script which contains the logic and functions required to install or uninstall an application.
Contents of the PowerShellTemplate Directory for PSADT v3
In addition to the Deploy-Application.ps1 template file, the PowerShellTemplate directory also includes these additional files:
File |
Description |
|||||||||||||||||||||
Deploy-Application.exe Deploy-Application.exe.config |
Executable that invokes a PowerShell script. |
|||||||||||||||||||||
Deploy-Application.ps1 |
PowerShell script template file which is modified by the Wrap Package Wizard to contain the actual install logic for the specific package, including:
The variable corresponding is $dirFiles variables (toolkit variable found under, AppDeployToolkit\AppDeployToolkitMain.ps1).
The variable corresponding is {appName}
The variable corresponding is {appVersion}
The variable corresponding is {appVendor}
The variable corresponding is {appLang}
The variable corresponding is {InstallPackage}
The variable corresponding is {UnInstallPackage} For example, if Picasa.msi is the package to be wrapped, it's installer path would be: $dirFiles\Picasa.msi |
|||||||||||||||||||||
AppDeployToolkit\AppDeployToolkitBanner.png |
Banner image which can be customized to brand the PowerShell installer. |
|||||||||||||||||||||
AppDeployToolkit\AppDeployToolkitLogo.ico |
Image used when the PowerShell installer runs. |
|||||||||||||||||||||
AppDeployToolkit\AppDeployToolkitConfig.xml |
Contains configurable preferences for how the toolkit behaves, including language settings. |
|||||||||||||||||||||
AppDeployToolkit\AppDeployToolkitExtensions.ps1 |
Script containing your extensions for the framework. |
|||||||||||||||||||||
AppDeployToolkit\AppDeployToolkitMain.ps1 |
Main script with all functions. |
|||||||||||||||||||||
AppDeployToolkit\AppDeployToolkitHelp.ps1 |
Help file explaining the functions. |
|||||||||||||||||||||
AppDeployToolkit\AppDeployToolkitMain.cs |
Additional functions. |
Rules for a Custom PowerShell Template
If you are creating a custom PowerShell template file, observe the following rules:
• | Do not rename Deploy-Application.ps1—The Deploy-Application.exe application looks for a file named Deploy-Application.ps1. Therefore, if the .ps1 file name is changed to the package name or anything else, the install/uninstallation will fail. |
• | Deploy-Application.ps1 must be in the root folder—The Deploy-Application.exe application expects the Deploy-Application.ps1 file to be present in the root folder level, the same folder that contains the Deploy-Application.exe file. |
• | Installer package must be in the Files folder—The installer package (.msi or .exe) must be in the Files folder. |
• | AppDeployToolkit must be in the root folder—The AppDeployToolkitfolder (along with all of its contents) must be in the root folder. |
Note:Installation/uninstallation is not obstructed if the Deploy-Application.exe.config file is not present in the parent folder level or is even deleted.
Note:The $dirFiles variable includes the path to the installer package. If you change the value of this variable, installation will fail.
Contents of the PowerShellTemplate Directory for PSADT v4
In addition to the Invoke-AppDeployToolkit.ps1 template file, the PowerShellTemplate directory also includes these additional files:
File |
Description |
|||||||||||||||||||||
Invoke-AppDeployToolkit.exe |
Executable that invokes a PowerShell script. |
|||||||||||||||||||||
Invoke-AppDeployToolkit.exe.config |
Configuration for the executable launcher. |
|||||||||||||||||||||
Invoke-AppDeployToolkit.ps1 |
Main entry point script that replaces the previous Deploy-Application.ps1. This is the primary script modified by the Wrap Package Wizard. PowerShell script template file which is modified by the Wrap Package Wizard to contain the actual install logic for the specific package, including:
The variable corresponding is $($adtSession.DirFiles)
The variable corresponding is {appName}
The variable corresponding is {appVersion}
The variable corresponding is {appVendor}
The variable corresponding is {appLang}
The variable corresponding is {InstallPackage}
The variable corresponding is {UnInstallPackage} For example, if Picasa.msi is the package to be wrapped, it's installer path would be: $($adtSession.DirFiles)\Picasa.msi |
|||||||||||||||||||||
PSAppDeployToolkit/ |
Directory containing the toolkit modules (replaces AppDeployToolkit). |
|||||||||||||||||||||
PSAppDeployToolkit/PSAppDeployToolkit.psd1 |
Module manifest. |
|||||||||||||||||||||
PSAppDeployToolkit/Private/ |
Contains internal functions. |
|||||||||||||||||||||
PSAppDeployToolkit/Public/ |
Contains public functions. |
|||||||||||||||||||||
PSAppDeployToolkit/Resources/ |
Contains resources such as logos and banners. |
|||||||||||||||||||||
Files/ |
Contains all installation files including the MSI/EXE. |
Rules for a Custom PowerShell Template
If you are creating a custom PowerShell template file, observe these rules:
• | Do not rename Invoke-AppDeployToolkit.ps1—The executable looks for this specific filename or rename both .exe and .ps1 with same name. |
• | Invoke-AppDeployToolkit.ps1 must be in the root folder—Same level as the executable. |
• | Installer package must be in the Files folder—Referenced by $($adtSession.DirFiles). |
• | PSAppDeployToolkit folder must be in the root folder—Contains all module components. |
Note:The $($adtSession.DirFiles) variable includes the path to the installer package. If you change the value of this variable, installation will fail.