Powershell App Deployment Toolkit
Table of Contents
Open-source PowerShell framework for standardising Windows software deployments at scale. Wraps vendor installers (MSI, EXE) with a consistent workflow, branded user interface, and extensive logging. Integrates natively with Intune and ConfigMgr (SCCM). Stewardship held by Patch My PC since 2024.
Current major version: v4.x (requires PowerShell 7.4+) Docs: https://psappdeploytoolkit.com/docs GitHub: https://github.com/PSAppDeployToolkit/PSAppDeployToolkit
Related: PowerShell Microsoft Intune
Installation
# From PowerShell Gallery (recommended) Install-Module -Name PSAppDeployToolkit -Scope CurrentUser # Or download the zip from GitHub releases and extract # https://github.com/PSAppDeployToolkit/PSAppDeployToolkit/releases
Folder Structure
MyApp-1.0\
├── Deploy-Application.ps1 ← your deployment script
├── Deploy-Application.exe ← launcher (runs as SYSTEM)
├── AppDeployToolkit\ ← toolkit files (don't edit)
│ ├── PSAppDeployToolkit\ ← PowerShell module
│ └── AppDeployToolkitConfig.psd1
└── Files\ ← your installer files go here
├── setup.msi
└── setup.exe
Deployment Phases
Every PSADT deployment follows three phases:
| Phase | When | Typical tasks |
|---|---|---|
| Pre-installation | Before installer runs | Close conflicting apps, backup files, remove old version |
| Installation | The main install | Run MSI/EXE installer |
| Post-installation | After installer | Set registry keys, copy config files, shortcuts |
Same three phases apply to Uninstallation and Repair.
Deploy-Application.ps1 Structure
$adtSession = @{
AppName = 'Mozilla Firefox'
AppVersion = '126.0'
AppVendor = 'Mozilla'
DeploymentType = 'Install' # Install | Uninstall | Repair
}
# Open the session
Open-ADTSession -SessionState $ExecutionContext.SessionState @adtSession
##*===============================================
##* PRE-INSTALLATION
##*===============================================
# Prompt user to close Firefox before installing
Show-ADTInstallationWelcome -CloseProcesses 'firefox' -AllowDefer -DeferTimes 3
##*===============================================
##* INSTALLATION
##*===============================================
# Install MSI
Start-ADTMsiProcess -Action 'Install' -FilePath 'Firefox Setup 126.0.msi' `
-AdditionalArguments '/QB-'
# Or install EXE
Start-Process -FilePath 'Files\setup.exe' -ArgumentList '/S' -Wait
##*===============================================
##* POST-INSTALLATION
##*===============================================
# Set a registry key
Set-ADTRegistryKey -Key 'HKLM:\Software\MyApp' -Name 'Installed' -Value '1'
# Close the session
Close-ADTSession
Key Functions
Installation
# MSI install / uninstall
Start-ADTMsiProcess -Action 'Install' -FilePath 'app.msi'
Start-ADTMsiProcess -Action 'Uninstall' -FilePath 'app.msi'
Start-ADTMsiProcess -Action 'Uninstall' -ProductCode '{GUID}'
# Run any executable
Start-Process -FilePath 'Files\setup.exe' -ArgumentList '/silent' -Wait
User interaction
# Prompt user to close apps (with optional deferral) Show-ADTInstallationWelcome -CloseProcesses 'word','excel' -AllowDefer -DeferTimes 3 # Show progress bar Show-ADTInstallationProgress -StatusMessage 'Installing Firefox...' # Show completion Show-ADTInstallationPrompt -Message 'Installation complete.' -ButtonRightText 'OK' # Prompt restart Show-ADTInstallationRestartPrompt -CountdownSeconds 120
File and registry operations
# Copy files Copy-ADTFile -Path 'Files\config.ini' -Destination "$env:ProgramFiles\MyApp\" # Registry Set-ADTRegistryKey -Key 'HKLM:\Software\MyApp' -Name 'Setting' -Value 'Value' Remove-ADTRegistryKey -Key 'HKLM:\Software\MyApp' Get-ADTRegistryKey -Key 'HKLM:\Software\MyApp' -Value 'Setting'
Detection and conditions
# Check if application is already installed
$installed = Get-ADTApplication -Name 'Firefox'
if ($installed) { Close-ADTSession -ExitCode 0 } # already installed, exit cleanly
# Get free disk space
$freeDisk = Get-ADTFreeDiskSpace -Drive 'C:'
Deployment Modes
| Mode | Behaviour | When used |
|---|---|---|
| Auto (default) | Silent if no user/OOBE, interactive otherwise | Normal Intune/SCCM deployments |
| Interactive | Always shows UI | Manual installs, testing |
| Silent | Never shows UI | Unattended, background deployments |
| NonInteractive | Minimal UI | Task sequences |
# Override mode at runtime Deploy-Application.exe -DeploymentType Install -DeployMode Silent
Integration with Intune
No longer requires ServiceUI to display UI from SYSTEM context — v4 uses a client-server architecture where UI runs in the user session and logic runs as SYSTEM.
Intune Win32 app settings: Install command: Deploy-Application.exe -DeploymentType Install Uninstall command: Deploy-Application.exe -DeploymentType Uninstall Detection rule: Registry key or file set during Post-installation
Package with the IntuneWinAppUtil.exe tool to create a .intunewin file.
Logging
PSADT provides extensive logging of both toolkit functions and MSI installation/uninstallation.
Default log location: C:\Windows\Logs\Software\ Log filename: AppName_DeploymentType_DateTime.log Logs capture: — Every function called — MSI verbose output — Exit codes — User interaction choices (deferred, accepted, etc.)
Exit Codes
| Code | Meaning |
|---|---|
| 0 | Success |
| 1641 | Success — restart required (initiated) |
| 3010 | Success — restart required (soft) |
| 60001 | Toolkit initialisation failed |
| 60002 | Script error |
| 1618 | Another install in progress |
| 1 | Generic failure |
Tips
- Always test locally before deploying via Intune or SCCM —
run
Deploy-Application.exe -DeploymentType Installmanually to verify before packaging - Check the log file first when troubleshooting — it captures the full execution including MSI verbose output
- The
Files\folder is where vendor installer files go; reference them as relative paths in the script Show-ADTInstallationWelcomewith-AllowDefergives users the option to delay — important for updates to apps they may have open mid-day- Run
Show-ADTHelpConsole(from the AppDeployToolkit folder) for a GUI browser of all available functions and their parameters