About The PowerShell App Deployment Toolkit
The PowerShell App Deployment Toolkit was launched in August 2013 and is a joint collaboration between Seán Lillis and Dan Cunningham. Muhammad Mashwani and Aman Motazedian. You can use it for whatever deployment mechanism or ESD you are using in your infrastructure. It is written completely in PowerShell and has a lot of functions around deploying applications to endpoints and users. It is licensed under the Microsoft Public License (Ms-PL). See some of the features in the following list:
Main Features of the PowerShell App Deployment Toolkit
- Easy To Use
- User Interface
- Integration with SCCM 2012 R2
Functions/Logic (besides others)
- Provides extensive logging of both the Toolkit functions and any MSI installation / uninstallation
- Provides the ability to execute any type of setup (MSI or EXEs) and handle / translate the return codes
- Mass remove MSI applications with a partial match (e.g. remove all versions of all MSI applications which match “Office”)
- Check for in-progress MSI installations and wait for MSI Mutex to become available
- Send a sequence of keys to an application window
- Perform SCCM actions such as Machine and User Policy Refresh, Inventory Update and Software Update
- Supports installation of applications on Citrix XenApp/Remote Desktop Session Host Servers
- Check File versions
- Pin or Unpin applications to the Start Menu or Task Bar
- Create Start Menu Shortcuts
- Register / Unregister DLL files
- Refresh desktop icons
- Test network connectivity
- Test power connectivity
- Check whether a PowerPoint slideshow is running
How does it look like?
The GUI is basically what the user sees during a deployment of a package if you want him to so something. Because the PSADK is very customizable you can change things to whatever you like. You can create full interactive packages or silent one´s.
This is what you see when you run “Deploy-Application.exe” without further parameters:
On the first screen that comes up I changed the banner to something that fits more likely from my perspective ;-). And that is the first example of how customizable it is.
You can configure defer settings or check the disk space before deploying a application – if you like. Let´s Continue… Installation in progress…
After the successfull installation the summary window comes up. You can see the standard message in the next window.
I will show you in a few moments how to change this. First let´s have a look at the package structure…
Deep Dive into the package structure
Every PSADK consists of 2 folders and three files in the root directory. The AppDeployToolkit folder contains the configuration files and function files. The Files folder is used for the source files. There you copy all the files that are needed in order to install the package. Alternatively you can create a variable for all your scripts that points to a central file share. That way you can skip putting the source files there. Personally I like the idea of having a “closed” package with the installation logic and the files in it.
Because you can insert version numbers into the script header it is easy to version packages.
If we switch to the AppDeploymentToolkit folder you will find the following files:
- AppDeployToolkitBanner.png (the banner you see during the installation process and that I changed already)
- AppDeployToolkitConfig.xml (configuration file with language settings etc.)
- AppDeployToolkitExtensions.ps1 (script with your extensions for the framework)
- AppDeployToolkitHelp.ps1 (a good helpfile explaining the functions)
- AppDeployToolkitLogo.ico (the icon file)
- AppDeployToolkitMain.cs (some further functions)
- AppDeployToolkitMain.ps1 (main script with all functions)
The default log path is set to C:\Windows\Logs. After the installation of a package you can check for issues or errors at this place.
You can open the log files for example with Notepad or with CMTrace.exe. And that is again a point I really like. Looking at log files with CMTrace.exe is very straight forward and makes the process of troubleshooting application installation issues easy.
You can change default settings in the AppDepleyToolkitConfig.xml file. Be sure to change it once in a template and to copy this template for every package you want to create.
You can start AppDeployToolkitHelp.ps1 to check the available help for all functions.
Now let´s change the text at the end of the installation. We need to open the Deploy-Application.ps1 file and change the following line in the code to a text you like or remove it completely:
Why I love it!
I love standardization as well as packages and scripts that follow guidelines. And that´s what makes the PSADK so special. It enhances – if you like – your SCCM environment with functions you don´t get with the standard SCCM function set. Even if you don´t use SCCM or another ESD solution you can benefit from standardized installation and configuration packages. Again, if you use a standard like PowerShell you can reuse all of your software packages, even if you switch from SCCM to Empirum, Heat or want to deploy your applications through PowerShell DSC. No other language offers so many options.
Why I hate it!
Complex installations can be hard to read if they extend to a certain level. All phases are integrated in one main script and even if you use tools like the PowerShell ISE or Visual Studio Code it can sometimes be hard to edit. Especially if you use pre- and post-installation and uninstallation areas and have a huge amount of variables and functions.
Where can You use it?
Like I said before, nearly everywhere! If you created a package you can use it stand alone, in a script that runs the packages, you can integrate and deploy it via Group Policy or – and that´s the best thing in larger environments – with your ESD (e.g. SCCM).
Here you can see an example script file from the toolkit. It is very simple and I haven´t done any parameter initialization or inserted special variables for the installation parameters.
.SYNOPSIS This script performs the installation or uninstallation of an application(s). .DESCRIPTION The 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 3 main sections/phases: Pre-Install, Install, and Post-Install. The script dot-sources the AppDeployToolkitMain.ps1 script which contains the logic and functions required to install or uninstall an application. .PARAMETER DeploymentType The type of deployment to perform. Default is: Install. .PARAMETER DeployMode Specifies whether the installation should be run in Interactive, Silent, or NonInteractive mode. Default is: Interactive. Options: Interactive = Shows dialogs, Silent = No dialogs, NonInteractive = Very silent, i.e. no blocking apps. NonInteractive mode is automatically set if it is detected that the process is not user interactive. .PARAMETER AllowRebootPassThru Allows the 3010 return code (requires restart) to be passed back to the parent process (e.g. SCCM) if detected from an installation. If 3010 is passed back to SCCM, a reboot prompt will be triggered. .PARAMETER TerminalServerMode Changes to "user install mode" and back to "user execute mode" for installing/uninstalling applications for Remote Destkop Session Hosts/Citrix servers. .PARAMETER DisableLogging Disables logging to file for the script. Default is: $false. .EXAMPLE Deploy-Application.ps1 .EXAMPLE Deploy-Application.ps1 -DeployMode 'Silent' .EXAMPLE Deploy-Application.ps1 -AllowRebootPassThru -AllowDefer .EXAMPLE Deploy-Application.ps1 -DeploymentType Uninstall .NOTES Toolkit Exit Code Ranges: 60000 - 68999: Reserved for built-in exit codes in Deploy-Application.ps1, Deploy-Application.exe, and AppDeployToolkitMain.ps1 69000 - 69999: Recommended for user customized exit codes in Deploy-Application.ps1 70000 - 79999: Recommended for user customized exit codes in AppDeployToolkitExtensions.ps1 .LINK http://psappdeploytoolkit.com #>