A PSADT package is the build output of application packaging. What the preceding article on PSADT 4 Application Deployment in ConfigMgr covered was the consumer side: how Configuration Manager takes a finished package and turns it into a deployed application. This article covers the producer side: how the package itself comes into being.
The walkthrough uses 7-Zip as its example. The choice is deliberate. 7-Zip is available as both MSI and EXE, has no licensing friction, is useful to almost every estate, and exposes the full range of decisions a packager must make — silent parameters, detection design, user-context handling, cleanup logic — without being trivial. A package that handles 7-Zip well is a package that can handle almost anything.
Get-ADTInstalledApplication and parameter forms (-AddParameters, a product code passed to -FilePath) that do not exist in 4.1.x. The code now follows the 4.1.8 template and function reference; log file names, the launcher's elevation behaviour and the checksum step were corrected as well. The example version remains 7-Zip 24.09. Updated November 30, 2026: the checksum paragraph now states where a published digest comes from (the GitHub release that 7-zip.org links to, not 7-zip.org itself) and that the 24.09 assets carry none.
The workflow below tracks a real packaging session end to end: acquiring and verifying the source, inspecting the installer, setting up the PSADT template, writing each wrapper section, testing under both SYSTEM and user context, signing the entry point, and finally handing the package off to ConfigMgr. Every step is shown against the 7-Zip example, with the general pattern made explicit so that the same approach applies to any other application.
A guided version of this workflow is the free course PSADT v4 — Your First Package: six lessons that build, test and hand over the 7-Zip MSI package step by step in a lab, with a check after each step. It uses the current 7-Zip release and was run in a lab before publication.
The Packaging Workspace
Before any installer is touched, a packaging workspace is established. A well-organised workspace pays dividends throughout the lifecycle of every package; a chaotic workspace guarantees that a package revision six months from now will be impossible to reproduce.
Folder Convention
The convention used here follows vendor → product → version:
\\packaging\Packages\
├── 7-Zip\
│ ├── 24.09\
│ │ ├── Source\ ← original vendor installer + checksums
│ │ ├── Package\ ← PSADT package, ready for deployment
│ │ └── Notes.md ← packaging journal for this version
│ └── 24.08\ ← previous version, retained for rollback
├── Google-Chrome\
│ └── 128.0.6613.138\
└── _Templates\
└── PSAppDeployToolkit_Template_v4\ ← untouched toolkit templateSource holds the pristine vendor download plus its checksum (the one published by the download source, where there is one, otherwise the hash recorded at download). Package holds the PSADT structure with the installer embedded. Notes.md is a plain journal — packaging decisions, quirks discovered during testing, dates of sign-off. In practice, Notes.md is what makes a package maintainable by a successor; it is worth the five minutes it takes to write.
The PSADT Template
The toolkit itself is a one-time download from the PSAppDeployToolkit repository. For 4.1.8, the release asset PSAppDeployToolkit_Template_v4.zip contains a ready package skeleton that serves as the starting point for every new package; with the module installed from the PowerShell Gallery, New-ADTTemplate creates the same skeleton. This template is never edited in place — it is copied for each package, and the copy is what the packager works on.
# Copy the template for a new package
Copy-Item `
-Path '\\packaging\Packages\_Templates\PSAppDeployToolkit_Template_v4' `
-Destination '\\packaging\Packages\7-Zip\24.09\Package' `
-RecurseUpdates to the toolkit itself (minor releases, security patches) are applied by re-downloading the template and carrying forward only the customised sections of the wrapper — never by attempting a partial overlay.
Acquiring the Installer
Source and Integrity
7-Zip is downloaded from 7-zip.org. Two variants matter:
- MSI —
7z2409-x64.msi, the installer used for enterprise deployment - EXE —
7z2409-x64.exe, an NSIS-based installer that works but is harder to script cleanly
For a PSADT package, the MSI is the superior choice. It exposes a stable product code, responds predictably to msiexec arguments, writes a proper uninstall entry to the registry, and produces a structured log when invoked with /l*v. The EXE variant is retained as a fallback for platforms where the MSI is unavailable.
If the download source publishes a checksum, it is compared before packaging. The 7-Zip download page itself lists file type, platform and size, but no checksum. Its link for the current MSI points to the project's GitHub release, and GitHub shows a SHA-256 digest next to each release asset. GitHub computes these digests at upload time, a feature introduced in June 2025, so assets uploaded earlier can lack one: for the 24.09 MSI used here, uploaded in November 2024 and no longer listed on 7-zip.org but still available from its GitHub release, neither the release page nor the GitHub API shows a digest (checked on November 30, 2026), while the current 26.06 MSI has one. For 24.09, the packager therefore records the SHA-256 hash in Notes.md when the file is first downloaded and verifies every later copy against it; for a release with a published digest, the recorded hash is compared with that digest first (PowerShell's -ne ignores case, so the lower-case GitHub value works without its sha256: prefix). A tampered or truncated installer discovered during production deployment is the kind of incident that ends careers.
# Verify the SHA-256 of the installer against the hash recorded in Notes.md
$expected = 'REPLACE-WITH-RECORDED-HASH'
$actual = (Get-FileHash '.\Source\7z2409-x64.msi' -Algorithm SHA256).Hash
if ($actual -ne $expected) { throw "Hash mismatch — aborting packaging" }The verified file is then staged in the package under Files\:
Copy-Item `
-Path '.\Source\7z2409-x64.msi' `
-Destination '.\Package\Files\7z2409-x64.msi'Inspecting the MSI
Before any wrapper code is written, the installer's internal structure is examined. Two tools cover the common cases: the Windows Installer command line, and Microsoft's MSI table editor Orca.
For routine inspection, the command line is sufficient:
# Run an administrative install into a scratch folder to extract the MSI tables
msiexec /a '.\Files\7z2409-x64.msi' TARGETDIR='C:\Scratch\7zip' /qn
# Read the ProductCode, ProductVersion, and UpgradeCode from the extracted MSI
$msi = 'C:\Scratch\7zip\7z2409-x64.msi'
$wi = New-Object -ComObject WindowsInstaller.Installer
$db = $wi.OpenDatabase($msi, 0)
foreach ($prop in 'ProductCode','ProductVersion','UpgradeCode','Manufacturer') {
$view = $db.OpenView("SELECT Value FROM Property WHERE Property = '$prop'")
$view.Execute()
$rec = $view.Fetch()
"{0,-16} = {1}" -f $prop, $rec.StringData(1)
}Typical output for 7-Zip 24.09 x64:
ProductCode = {23170F69-40C1-2702-2409-000001000000}
ProductVersion = 24.09
UpgradeCode = {23170F69-40C1-2702-0000-000004000000}
Manufacturer = Igor PavlovThe values above were recorded for 24.09; every build has its own ProductCode, so these values are always read from the MSI that is actually staged in Files\. With the PSADT module loaded, Get-ADTMsiTableProperty -LiteralPath '.\Files\7z2409-x64.msi' returns the same Property table without an administrative install. The ProductCode is the MSI's unique identifier and the cleanest target for a detection method. The UpgradeCode is shared across versions and is what the MSI uses to recognise older installs for upgrade — useful when writing upgrade logic in the wrapper.
First Silent Install Test
Before any PSADT code is written, the raw silent install is proven on a clean test machine. If the vendor installer does not install silently by itself, no amount of wrapping will fix it.
# On a clean test VM
msiexec /i '.\7z2409-x64.msi' /qn /norestart /l*v 'C:\Temp\7zip-install.log'The log at C:\Temp\7zip-install.log is inspected for:
- Return value 1 — success
- Return value 3 — fatal error; the message just before the return value identifies the cause
- Any MSI property that needed to be set explicitly (some MSIs require
ALLUSERS=1for a per-machine install)
For 7-Zip, the MSI installs cleanly with no additional properties. Other vendors are less cooperative; a packager who has not run the raw silent install first is guaranteed to lose hours later.
The PSADT Package Layout
With the template copied and the installer staged, the package folder now contains the following structure:
Package\
├── Files\
│ └── 7z2409-x64.msi ← primary vendor installer
├── SupportFiles\ ← auxiliary content (empty for 7-Zip)
├── Assets\ ← AppIcon.png and banner for the dialogs
├── Config\
│ └── config.psd1 ← toolkit settings for this package
├── Strings\
│ └── strings.psd1 ← dialog texts for this package
├── PSAppDeployToolkit\ ← the toolkit module, read-only copy (do not edit)
├── PSAppDeployToolkit.Extensions\ ← optional custom functions
├── Invoke-AppDeployToolkit.ps1 ← the wrapper script (edited by packager)
└── Invoke-AppDeployToolkit.exe ← signed entry point (called by deployment engine)Two of these files are the packager's canvas:
Invoke-AppDeployToolkit.ps1— the PowerShell wrapper script with the$adtSessionmetadata and the functionsInstall-ADTDeployment,Uninstall-ADTDeploymentandRepair-ADTDeployment, each divided into a Pre, main and Post phase (Pre-Install, Install, Post-Install, Pre-Uninstall, Uninstall, Post-Uninstall, and the repair equivalents)Invoke-AppDeployToolkit.exe— the entry-point executable that the deployment engine calls; it starts Windows PowerShell in a hidden window with-ExecutionPolicy Bypass -NonInteractive -NoProfile -NoLogo, runsInvoke-AppDeployToolkit.ps1and returns its exit code. Since 4.1 the launcher no longer relaunches itself elevated: it must be started with administrator rights, which a deployment engine running as SYSTEM provides. With the template defaultRequireAdmin = $true, a non-elevated run stops with exit code60008.
Everything inside PSAppDeployToolkit\ is the toolkit module and is not modified by packagers. Package-specific settings belong in Config\config.psd1 and Strings\strings.psd1 at the package root; custom behaviour is added through the extension mechanism (outside the scope of this article) or through the wrapper script.
PSAppDeployToolkit\ produces a package that cannot be upgraded cleanly when a new toolkit release appears. Customisation belongs in the wrapper script or in a formal extension.
Writing the Wrapper — The Header
The top of Invoke-AppDeployToolkit.ps1 holds the application metadata in the $adtSession hashtable. These fields feed the dialog titles, the log file names, and the strings shown in user-facing prompts. Filling them in is not cosmetic — the toolkit builds the install name from vendor, name, version, architecture, language and revision, and every log file is named after it. Identical metadata in two packages means two packages writing to the same log, which is what makes a support queue impossible to triage. An empty AppName would additionally switch the template into Zero-Config MSI mode.
$adtSession = @{
# App variables.
AppVendor = 'Igor Pavlov'
AppName = '7-Zip'
AppVersion = '24.09'
AppArch = 'x64'
AppLang = 'EN'
AppRevision = '01'
AppSuccessExitCodes = @(0)
AppRebootExitCodes = @(1641, 3010)
AppProcessesToClose = @(
@{ Name = '7zFM'; Description = '7-Zip File Manager' }
@{ Name = '7zG'; Description = '7-Zip GUI' }
@{ Name = '7z'; Description = '7-Zip Console' }
)
AppScriptVersion = '1.0.0'
AppScriptDate = '2026-04-20'
AppScriptAuthor = 'Miloch'
RequireAdmin = $true
# Install Titles (Only set here to override defaults set by the toolkit).
InstallName = ''
InstallTitle = '7-Zip 24.09 x64'
# Script variables.
DeployAppScriptFriendlyName = $MyInvocation.MyCommand.Name
DeployAppScriptParameters = $PSBoundParameters
DeployAppScriptVersion = '4.1.8'
}With these values the toolkit generates the install name IgorPavlov_7-Zip_24.09_x64_EN_01 (spaces removed, empty fields skipped). AppProcessesToClose holds the 7-Zip executables once for all deployment types; the welcome dialogs below reuse the list.
The revision field is critical for iterative packaging. When a package is rebuilt because a post-install tweak failed in the field, the revision increments (01 → 02) even if the application version did not change. This distinguishes the two builds in reporting and in the log file names.
The install title is what the end user sees in PSADT dialogs. Left empty, the toolkit builds it from vendor, name and version. Here it is set to the ConfigMgr Application's display name — a small detail that makes the user experience coherent.
Pre-Installation Section
The Pre-Installation section handles everything that must happen before the vendor installer runs: telling the user what is about to happen, asking them to close running instances of the application, uninstalling incompatible previous versions, and cleaning up state that would otherwise poison the fresh install.
##================================================
## MARK: Pre-Install
##================================================
$adtSession.InstallPhase = "Pre-$($adtSession.DeploymentType)"
## Show welcome message, ask to close running 7-Zip instances, allow deferral
Show-ADTInstallationWelcome `
-CloseProcesses $adtSession.AppProcessesToClose `
-CloseProcessesCountdown 600 `
-AllowDefer `
-DeferTimes 3 `
-PersistPrompt `
-CheckDiskSpace
## Uninstall previous MSI-based 7-Zip versions found in the uninstall registry
Uninstall-ADTApplication -Name '7-Zip' -ApplicationType 'MSI'
## Remove NSIS-based 7-Zip if present (no product code)
$nsisUninstaller = 'C:\Program Files\7-Zip\Uninstall.exe'
if (Test-Path $nsisUninstaller) {
Start-ADTProcess -FilePath $nsisUninstaller -ArgumentList '/S' -WaitForMsiExec
}Several decisions in this block deserve explicit notice.
The close-processes list is explicit. Wildcard or partial process names lead to the wrong processes being killed when the user has multiple unrelated applications running. Listing each executable name individually with a human-readable description produces the clearest user dialog and the safest closure logic.
Countdown and deferral give the user agency. -AllowDefer with -DeferTimes 3 offers three deferrals across three policy cycles, which gives ample time to pick a better moment. The ten-minute countdown (600 seconds) takes effect once deferral is no longer available; according to the function help, it then closes the listed applications automatically. PSADT handles all of this natively — no custom state-tracking is required. A deferral ends the run with exit code 1602 (DeferExitCode in config.psd1).
Disk-space check is cheap. -CheckDiskSpace adds a pre-install validation against the MSI's estimated footprint. For small packages this is overhead; for 500 MB suites installed on fleet laptops with tight storage, it is what prevents a partial install that cannot roll back.
Previous-version handling uses the uninstall registry. Uninstall-ADTApplication -Name '7-Zip' -ApplicationType 'MSI' enumerates the installed applications through Get-ADTApplication, matches every entry whose display name contains 7-Zip (the default -NameMatch is Contains), and removes each MSI-based match through its product code with Start-ADTMsiProcess. The match is name-based, not UpgradeCode-based; -FilterScript, for example { $_.Publisher -eq 'Igor Pavlov' }, narrows it further. The separate NSIS cleanup handles the case where someone previously installed the EXE variant.
Installation Section
The Installation section is usually the shortest. When the pre-installation work is done correctly, the actual vendor install is one or two lines.
##================================================
## MARK: Install
##================================================
$adtSession.InstallPhase = $adtSession.DeploymentType
## Install 7-Zip MSI
Start-ADTMsiProcess `
-Action 'Install' `
-FilePath "$($adtSession.DirFiles)\7z2409-x64.msi" `
-AdditionalArgumentList 'ALLUSERS=1'Three points about this call:
$adtSession.DirFiles resolves to the package's Files\ folder at runtime. Hardcoding paths like C:\Temp\Files\ is what breaks a package the moment it runs from the ConfigMgr cache instead of the packaging share. (A bare file name in -FilePath is resolved against the same folder.)
ALLUSERS=1 forces a per-machine install. Some MSIs install per user when the property is not set; passing it makes the per-machine intent explicit. -AdditionalArgumentList adds to the default msiexec parameters from Config\config.psd1, whereas -ArgumentList would replace them. In 4.1.8 those defaults are REBOOT=ReallySuppress /QN, so REBOOT=ReallySuppress is not repeated here: the default already prevents the MSI from scheduling a reboot on its own. Reboot orchestration belongs to the deployment engine, not to the installer.
PSADT's Start-ADTMsiProcess handles the log path automatically — the MSI log is written with /L*V to the toolkit's log directory, named after the MSI's product name and product version (spaces removed) with the action appended, for example ..._Install.log. If the product code is already installed, the function logs The MSI is already installed on this system. Skipping action [Install]... and does nothing.
Exit-Code Handling
Not every non-zero exit code is a failure. 3010 means success, but a reboot is required; 1641 means success, reboot initiated. Both are listed in AppRebootExitCodes in the template, so PSADT treats them as success and, since 4.1.0, passes them through to the deployment engine as the package's exit code, signalling that a reboot is pending (-SuppressRebootPassThru turns them into 0). No custom handling is required for the common cases.
When a vendor installer uses non-standard exit codes (some do), the wrapper declares them as success explicitly:
# Vendor returns 10 for "success but config pending"; treat 0 and 10 as success
Start-ADTProcess `
-FilePath "$($adtSession.DirFiles)\vendor-installer.exe" `
-ArgumentList '/S' `
-SuccessExitCodes 0, 10For 7-Zip, the standard MSI exit codes are sufficient.
Post-Installation Section
The Post-Installation section handles anything the vendor installer cannot be trusted to do, or does badly. For 7-Zip, this typically means setting file associations, tidying start-menu shortcuts, and optionally seeding per-machine preferences.
##================================================
## MARK: Post-Install
##================================================
$adtSession.InstallPhase = "Post-$($adtSession.DeploymentType)"
## Set 7-Zip as the default handler for archive types (per-machine)
$archiveTypes = @('.7z', '.zip', '.tar', '.gz', '.bz2', '.xz', '.rar')
foreach ($ext in $archiveTypes) {
Set-ADTRegistryKey `
-Key "HKLM:\SOFTWARE\Classes\$ext\OpenWithProgids" `
-Name '7-Zip.File' `
-Value '' `
-Type String
}
## Remove the 'Visit 7-Zip website' start menu entry (optional policy)
$unwantedShortcut = "$envCommonStartMenuPrograms\7-Zip\7-Zip Web Site.lnk"
if (Test-Path $unwantedShortcut) {
Remove-ADTFile -Path $unwantedShortcut
}
## Show completion message (only when running interactively)
Show-ADTInstallationPrompt `
-Message "7-Zip $($adtSession.AppVersion) has been installed successfully." `
-ButtonRightText 'OK' `
-Icon Information `
-NoWaitWhether any of this is appropriate is a policy decision. Some estates mandate 7-Zip as the default archive handler; others leave file associations to the user. The wrapper documents the decision in code, and the same code will apply consistently across the fleet.
-NoWait on the completion prompt prevents the deployment from hanging on an unattended machine: the prompt appears and the wrapper proceeds to its natural end without waiting for a click. In Silent mode the prompt is not shown at all.
Uninstall Logic
A good package uninstalls as cleanly as it installs. Uninstall logic follows the same three-section structure.
Pre-Uninstallation
##================================================
## MARK: Pre-Uninstall
##================================================
$adtSession.InstallPhase = "Pre-$($adtSession.DeploymentType)"
Show-ADTInstallationWelcome `
-CloseProcesses $adtSession.AppProcessesToClose `
-CloseProcessesCountdown 300 `
-PersistPromptUninstall does not offer deferral — when a user has been told their application will be removed, the removal must proceed. A three-hundred-second countdown is typically sufficient to save open files.
Uninstallation
##================================================
## MARK: Uninstall
##================================================
$adtSession.InstallPhase = $adtSession.DeploymentType
Start-ADTMsiProcess `
-Action 'Uninstall' `
-ProductCode '{23170F69-40C1-2702-2409-000001000000}'The ProductCode is hardcoded and passed to -ProductCode; in 4.1.8, -FilePath accepts only paths ending in .msi or .msp. This ties the wrapper to this specific MSI build — which is correct, because a wrapper for version 24.09 should uninstall 24.09, not any 7-Zip that happens to be on the system. Version-agnostic cleanup, when needed, belongs in a separate cleanup package.
Post-Uninstallation
##================================================
## MARK: Post-Uninstallation
##================================================
$adtSession.InstallPhase = "Post-$($adtSession.DeploymentType)"
## Remove the 7-Zip registry key if one was left behind
Remove-ADTRegistryKey -Key 'HKLM:\SOFTWARE\7-Zip' -Recurse
## Remove the install folder if non-empty leftovers exist
Remove-ADTFolder -Path "$envProgramFiles\7-Zip"MSI uninstall is supposed to remove everything the MSI created, but many vendors leave debris — empty folders, registry keys that were written by the installer outside the MSI's control, user-created files in the install folder. The post-uninstallation section cleans these up so the filesystem is genuinely as it was before the install.
Local Testing
A package that has not been tested is a theoretical package. PSADT makes testing straightforward as long as both contexts are exercised.
Interactive Test (User Context)
From an elevated Windows PowerShell 5.1 prompt (the launcher switches to PowerShell 7 when it is started from a pwsh process, which is not what the deployment engine does):
Set-Location '\\packaging\Packages\7-Zip\24.09\Package'
# The launcher is a Windows application: wait for it explicitly and capture the exit code
$run = Start-Process -FilePath '.\Invoke-AppDeployToolkit.exe' -ArgumentList '-DeploymentType Install -DeployMode Interactive' -Wait -PassThru
$run.ExitCodeThe expected flow:
- A welcome dialog appears, listing any open 7-Zip processes
- The install progresses with a PSADT progress bar
- The completion prompt appears briefly
- The wrapper exits with code
0
Common issues discovered at this stage:
- Welcome dialog lists no processes even when 7-Zip is open → process names in the wrapper are wrong
- Install progresses but fails at the MSI → silent parameters incorrect, check the MSI log under
C:\Windows\Logs\Software\ - Completion prompt does not appear → the session ran in Silent mode (the log line
Installation is running in [...] mode.shows which mode was used), or the wrapper ended before reaching Post-Install
Silent Test (System Context)
System-context execution simulates what ConfigMgr does. The cleanest way to reproduce it is PsExec from Sysinternals:
# Run the launcher as LOCAL SYSTEM, interactively, in the current session
# (SYSTEM reaches the share with the computer account, which needs read access)
psexec.exe -accepteula -i -s '\\packaging\Packages\7-Zip\24.09\Package\Invoke-AppDeployToolkit.exe' `
-DeploymentType Install -DeployMode SilentA successful silent run produces:
- No dialogs at all
- A log under
C:\Windows\Logs\Software\named for the application and phase - Exit code
0reported by PsExec
If the silent run fails where the interactive run succeeded, the difference is almost always in a step that assumed an interactive token — a UAC prompt, an HKCU-only registry write, a dialog that waited for user input.
Log Locations After a Test
All PSADT logs end up under C:\Windows\Logs\Software\ by default (LogPath in config.psd1), named <InstallName>_PSAppDeployToolkit_<DeploymentType>.log. For the 7-Zip package above, a successful install produces:
C:\Windows\Logs\Software\
├── IgorPavlov_7-Zip_24.09_x64_EN_01_PSAppDeployToolkit_Install.log ← master PSADT log
└── <ProductName>_<ProductVersion>_Install.log ← MSI log written by Start-ADTMsiProcessThe MSI log name comes from the MSI's own Property table, with spaces removed. Without administrator rights, the PSADT log name additionally ends in the user name.
Reading these two logs after every test is the baseline verification. An anomaly that is not visible in either log is rare.
Signing the Entry Point
In enterprise environments, the Invoke-AppDeployToolkit.exe entry point is signed with a code-signing certificate before the package is distributed. Signing produces two benefits: it allows SmartScreen and AppLocker policies to treat the executable as trusted, and it establishes a verifiable chain from the packager's identity to the deployed artifact.
Signing requires a code-signing certificate from an internal CA (the lab's Enterprise CA, or a commercial provider for internet-facing distribution). The certificate must be installed in the signing user's personal certificate store with the private key.
# Locate the code-signing certificate
$cert = Get-ChildItem Cert:\CurrentUser\My -CodeSigningCert |
Where-Object { $_.Subject -like '*CN=Packaging Signing*' } |
Select-Object -First 1
# Sign the entry-point executable
Set-AuthenticodeSignature `
-FilePath '.\Invoke-AppDeployToolkit.exe' `
-Certificate $cert `
-TimestampServer 'http://timestamp.digicert.com'The timestamp server is important: without it, the signature becomes invalid when the certificate eventually expires. With a timestamp, the signature remains valid as long as it was timestamped during the certificate's validity window, even long after the certificate has expired.
The wrapper script (Invoke-AppDeployToolkit.ps1) can be signed as well, but many enterprises rely on the PowerShell execution-policy bypass that the entry-point executable applies internally, and sign only the executable. Either approach is defensible.
Handing Off to ConfigMgr
The finished package folder — with a signed entry point, a tested wrapper, and a staged installer — is the content source for a ConfigMgr Application. The steps from here are covered in detail in the deployment article: creating the Application, defining a Script Installer deployment type, wiring up the install and uninstall commands against Invoke-AppDeployToolkit.exe, configuring the detection method against the MSI product code, and distributing the content to a Distribution Point.
For 7-Zip specifically, the ConfigMgr configuration that pairs with this package:
- Name:
7-Zip 24.09 x64 - Publisher:
Igor Pavlov - Version:
24.09 - Install command:
Invoke-AppDeployToolkit.exe -DeploymentType Install -DeployMode Interactive - Uninstall command:
Invoke-AppDeployToolkit.exe -DeploymentType Uninstall -DeployMode Silent - Detection method: MSI product code
{23170F69-40C1-2702-2409-000001000000} - User experience: Install for system, Only when a user is logged on. In 4.1.8, an explicit
-DeployMode Interactivestops with exit code1602when no user is signed in; deployments that must also run without a user use-DeployMode Silentor the defaultAuto. The Allow users to view and interact with the program installation checkbox is no longer required for PSADT dialogs since 4.1.0, according to the release notes.
The Application is then deployed to a pilot collection, verified against Software Center on the test client, and — after the pilot clears — promoted to the broader collection.
Common Pitfalls
Silent arguments that are not actually silent
A vendor installer documented as silent with /S sometimes pops a dialog anyway when it detects a previous version. Running the raw silent install first, on a clean VM, catches this before the wrapper is written. The wrapper then either uninstalls the previous version first (as shown above) or passes an additional flag to suppress the dialog.
MSI installs silently as a per-user install
When an MSI is invoked without ALLUSERS=1 and without elevation, some installers default to per-user. The installer succeeds, but the resulting deployment is visible only to the user who triggered it. ALLUSERS=1 in -AdditionalArgumentList prevents this category of silent failure.
Quotes inside Start-ADTProcess arguments Arguments containing paths with spaces must be quoted correctly. PowerShell's string handling plus the deployment engine's command parser produce four levels of quoting in the worst case. The cleanest pattern is the array form:
Start-ADTProcess `
-FilePath 'C:\Program Files\Vendor\installer.exe' `
-ArgumentList @(
'/S'
'/CONFIG="C:\Temp\config.ini"'
'/LOG="C:\Temp\install.log"'
)Using an array avoids the string-concatenation pitfalls entirely.
Close-process list does not close anything
The process name in Show-ADTInstallationWelcome -CloseProcesses must match the executable name without .exe. A typo or a changed name between versions produces a welcome dialog that lists no processes even when the application is open. A quick Task Manager check confirms the actual process name.
Wrapper runs but nothing installs
A 1619 exit code from msiexec means the package could not be opened. Common causes: the MSI was placed in SupportFiles\ instead of Files\, the path was hardcoded relative to the packaging share, or the file was lost during content distribution. Always reference $adtSession.DirFiles for files in Files\ and $adtSession.DirSupportFiles for SupportFiles\.
Signing after the fact invalidates ConfigMgr content hashes If a package is distributed to DPs and then signed retroactively, the content hashes on the DPs no longer match the package on the share. ConfigMgr will redistribute, but in the interim, clients that pull the old cached content will fail signature validation at the client side. Sign before distributing.
Revision not incremented after a rebuild
A package rebuilt to fix a post-install bug with the same AppVersion and AppRevision in $adtSession writes to the same log file as the previous build (the toolkit appends by default). Two different builds with the same log filename is what makes a production incident impossible to analyse in retrospect. Incrementing AppRevision on every rebuild is cheap insurance.
HKCU writes from a SYSTEM-context wrapper
SYSTEM has its own HKCU, which is not the logged-on user's HKCU. A wrapper that writes to HKCU under SYSTEM writes to a hive that no user will ever read. Per-user configuration belongs either in a per-user deployment (user collection) or in the Default User profile so that new logons inherit it, written through reg load / reg unload under SYSTEM.
Forgetting to test the uninstall Uninstall is as much a part of the package as install. A package that cannot cleanly uninstall accumulates in the estate and blocks upgrades. The local testing phase always includes Install → Uninstall → Install, with log inspection at each step.
Takeaways
Packaging is iterative by nature. A first pass produces a wrapper that installs; the second pass cleans up the install; the third pass tightens the uninstall; subsequent passes handle edge cases discovered during pilot rollouts. Attempting to get everything right in one session produces a wrapper that is both overengineered and brittle. Each section — Pre-Install, Install, Post-Install, and the three uninstall counterparts — is refined against real failures observed on real test machines.
The 7-Zip walkthrough above is the full pattern in a minimal case. A commercial suite with prerequisites, licence activation, user-profile seeding, and post-install registration extends the pattern without changing it. The same sections hold the same kinds of logic; only the details scale.
Two disciplines separate reliable packages from fragile ones. The first is testing under both contexts — interactive and SYSTEM — every time the wrapper is modified, not only at the end. The second is reading the log after every test, not only when something visibly fails. Silent failures with a zero exit code are real, and the log is where they surface.
Rule of thumb: Install it by hand first, silently, with a full MSI log. If that step does not succeed cleanly, no wrapper can paper over the result. Only when the raw installer behaves under msiexec /qn is it time to write a PSADT section around it.
Tested with: PSAppDeployToolkit v4 on Windows 11 24H2, 7-Zip 24.09 x64 MSI, Windows Server 2025 as the packaging share host, Configuration Manager Current Branch 2503 as the downstream deployment engine. Updated 2026-11-29: code and statements checked against the PSAppDeployToolkit 4.1.8 template, function help and source; the updated code has not been re-run in the lab. Updated 2026-11-30: checksum statement checked against the 7-Zip download page, the 7-Zip 24.09 release and 26.06 release on GitHub (release page and REST API), and the GitHub changelog Releases now expose digests for release assets.