m.miloch.dev ← PSADT v4 — Your First PackageCourse
Lesson 2 of 635 minFree course

The structure of a PSADT v4 package

How PSAppDeployToolkit 4.1 is obtained, what the folders of a package contain, how Invoke-AppDeployToolkit.ps1 is organised into deployment types and phases, what $adtSession holds, and how the four deploy modes behave.

In this lesson
  • Obtain PSADT 4.1.8 from the PowerShell Gallery or from a GitHub release
  • Create a new package with New-ADTTemplate and name the purpose of each folder
  • Find the Pre, main and Post sections for Install, Uninstall and Repair in the wrapper script
  • Fill in the $adtSession metadata and predict the resulting log file name
  • Choose between the Auto, Interactive, NonInteractive and Silent deploy modes

Lesson 1 ended with a raw silent installation. This lesson builds the container around it: a PSADT package. It covers where PSADT comes from, what every folder in a package is for, how the wrapper script is laid out, and how the toolkit decides whether to show dialogs. The exercise runs a first package that installs nothing but writes a complete log.

Getting PSADT 4.1

The download page of the official documentation names two sources: the PowerShell Gallery and the GitHub releases. Version 4.1.8 was released on 2026-01-14 and is the latest stable release on 2026-11-29.

Before the first module command. On Windows clients, the default execution policy is Restricted, which also blocks module files (.psm1) (about_Execution_Policies). Install-Module and New-ADTTemplate then fail with "running scripts is disabled on this system". This command allows scripts in the current console only:

powershell
# Allow scripts and modules in this console session only
Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process -Force

A policy set by Group Policy (MachinePolicy or UserPolicy in Get-ExecutionPolicy -List) cannot be overridden this way.

PowerShell Gallery. The module is installed once on the packaging machine:

powershell
# Install PSADT 4.1.8 for the current user
Install-Module -Name PSAppDeployToolkit -RequiredVersion 4.1.8 -Scope CurrentUser

# Confirm the installed version
Get-Module -Name PSAppDeployToolkit -ListAvailable | Select-Object -Property Name, Version

Without -RequiredVersion, Install-Module installs the latest stable version, which will be 4.2 once it is released; the course therefore pins 4.1.8. Windows PowerShell 5.1 ships with PowerShellGet 1.0.0.1. According to Microsoft's PowerShellGet instructions, the Gallery requires TLS 1.2. If Install-Module cannot reach the Gallery, run [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12 first. Microsoft no longer supports PowerShellGet 1.x and recommends updating it. On a machine that has never used the Gallery, PowerShellGet 1.0.0.1 asks two questions. The first offers to install the NuGet provider (default Y). The second reports an Untrusted repository and asks to confirm installing from PSGallery; its default is N, so pressing Enter cancels the installation. Answer Y to both.

GitHub releases. The 4.1.8 release of the PSAppDeployToolkit/PSAppDeployToolkit repository has three assets plus the source code:

AssetContent
PSAppDeployToolkit_ModuleOnly.zipThe module only. The download page calls it the minimum download.
PSAppDeployToolkit_Template_v4.zipA ready v4 package skeleton
PSAppDeployToolkit_Template_v3.zipA skeleton for v3 compatibility mode, for existing 3.x scripts

This route suits packaging machines without Gallery access. A ZIP downloaded with a browser carries the "downloaded from the internet" mark, which extraction can pass on to the files; under RemoteSigned, PowerShell does not run such unsigned scripts until they are unblocked:

powershell
# Remove the internet zone mark from all extracted template files
Get-ChildItem -Path 'C:\Lab\Packages\HelloPSADT' -Recurse -File | Unblock-File
Note
The documentation website serves the 4.2 development documentation at its default /docs/ paths. The 4.1 reference used in this course lives under /docs/4.1.x/. Version 4.2.0 is a release candidate on 2026-11-29; its changes are summarised in PSADT 4.2 RC2 for ConfigMgr and Intune Packagers.

Creating a package

With the module installed, New-ADTTemplate creates a new package folder:

powershell
# Create a new v4 package folder named HelloPSADT under C:\Lab\Packages
New-ADTTemplate -Destination 'C:\Lab\Packages' -Name 'HelloPSADT'
ParameterDefaultMeaning
-DestinationCurrent locationFolder in which the package folder is created
-NamePSAppDeployToolkit_<ModuleVersion>Name of the new package folder
-Version44 for the v4 template, 3 for v3 compatibility mode
-ShowOffOpens the new folder in File Explorer
-ForceOffReplaces an existing, non-empty folder
-PassThruOffReturns the new folder as an object

No parameter is mandatory. According to the 4.1.8 source, the function creates Files\ and SupportFiles\ with one placeholder text file each, copies the v4 front end (launcher, wrapper script, PSAppDeployToolkit.Extensions\) and the default Assets\, Config\ and Strings\ folders, and places a complete copy of the module in PSAppDeployToolkit\. It marks the module copy read-only, points the Import-Module line of the wrapper at that copy, and replaces the placeholder script date 2000-12-31 with the current date.

Warning
-Force does not merge. If the target folder exists and is not empty, the function stops with an error; with -Force, it deletes the existing folder and everything in it before creating the template.

The package is self-contained: it carries its own copy of the module and does not need PSADT installed on the target device.

The package folder

The 4.1 documentation describes the deployment structure. A package created by New-ADTTemplate 4.1.8 looks like this:

text
HelloPSADT\
├── Invoke-AppDeployToolkit.exe      launcher called by the deployment tool
├── Invoke-AppDeployToolkit.ps1      wrapper script: the packager's work area
├── PSAppDeployToolkit\              the module, read-only (do not modify)
├── PSAppDeployToolkit.Extensions\   optional custom functions
├── Files\                           installation media (MSI, EXE, MST, MSP)
├── SupportFiles\                    other files needed during installation
├── Assets\                          AppIcon.png, Banner.Classic.png
├── Config\                          config.psd1: toolkit settings
└── Strings\                         strings.psd1 plus one folder per language
Folder or fileEdited by the packagerPurpose
Invoke-AppDeployToolkit.ps1YesMetadata and the install, uninstall and repair logic
Invoke-AppDeployToolkit.exeNoStarts PowerShell with the wrapper script and passes the exit code back
Files\YesThe vendor installer; $adtSession.DirFiles points here at run time
SupportFiles\YesConfiguration files, .reg files and similar; $adtSession.DirSupportFiles
Config\, Strings\, Assets\RarelyLog paths, MSI defaults, dialog texts and branding for this package
PSAppDeployToolkit\NeverThe module itself; the documentation says not to modify anything in it
PSAppDeployToolkit.Extensions\OptionalReusable functions; outside the scope of this course

AppIcon.png is the dialog logo (256 × 256 PNG recommended); Banner.Classic.png is used only by the Classic dialog style. Settings in Config\config.psd1 used in this course:

Key4.1.8 defaultEffect
Toolkit.LogPath$envWinDir\Logs\SoftwareLog folder with administrator rights
Toolkit.LogPathNoAdminRights$envProgramData\Logs\SoftwareLog folder without administrator rights
Toolkit.LogWriteToHost$trueLog lines also appear in the console
UI.DeferExitCode1602Exit code of a deferred deployment

Inside Invoke-AppDeployToolkit.ps1

The wrapper script has the same five parts in every package. Comments of the form ## MARK: <name> label the variables block, every phase and the initialization and invocation blocks, so searching for MARK: in an editor jumps between them.

  1. Parameters. -DeploymentType (Install, Uninstall, Repair; default Install), -DeployMode (Auto, Interactive, NonInteractive, Silent; default Auto), and three switches: -SuppressRebootPassThru (exit with 0 instead of a reboot code such as 3010), -TerminalServerMode (install mode for Remote Desktop Session Hosts), -DisableLogging.
  2. Variables. The $adtSession hashtable with the package metadata.
  3. Deployment functions. Install-ADTDeployment, Uninstall-ADTDeployment and Repair-ADTDeployment.
  4. Initialization. Sets strict error handling, unblocks and imports the module from the package folder (or, if the folder is missing, an installed module with the same GUID and version 4.1.8 or later), and opens the session. If the module cannot be imported or the session cannot be opened, the script ends with exit code 60008 (one exception follows under deploy modes). Not edited.
  5. Invocation. Imports every sibling folder named PSAppDeployToolkit.* (the extensions), calls the deployment function that matches -DeploymentType, and closes the session. An unhandled error is logged and ends the session with exit code 60001. Not edited.

Deployment types and phases

Each deployment function is divided into three phases. The template sets the phase name at the start of each section, and every log line carries it; in the CMTrace log, the message starts with [Pre-Install] :: . While the session opens, the phase name is Initialization; from then until the first phase it is Execution, and Close-ADTSession switches it to Finalization.

Deployment typePre phaseMain phasePost phase
InstallPre-InstallInstallPost-Install
UninstallPre-UninstallUninstallPost-Uninstall
RepairPre-RepairRepairPost-Repair

The phase names come from the deployment type, not from the comments. In 4.1.8 the last marker of the uninstall function reads ## MARK: Post-Uninstallation, while the phase in the log is Post-Uninstall.

The layout of the install function in the 4.1.8 template, shortened:

powershell · 28 lines
function Install-ADTDeployment
{
    [CmdletBinding()]
    param
    (
    )

    ##================================================
    ## MARK: Pre-Install
    ##================================================
    $adtSession.InstallPhase = "Pre-$($adtSession.DeploymentType)"
    # Template: Show-ADTInstallationWelcome, Show-ADTInstallationProgress
    ## <Perform Pre-Installation tasks here>

    ##================================================
    ## MARK: Install
    ##================================================
    $adtSession.InstallPhase = $adtSession.DeploymentType
    # Template: Zero-Config MSI block
    ## <Perform Installation tasks here>

    ##================================================
    ## MARK: Post-Install
    ##================================================
    $adtSession.InstallPhase = "Post-$($adtSession.DeploymentType)"
    ## <Perform Post-Installation tasks here>
    # Template: Show-ADTInstallationPrompt with a sample message
}

The template is not empty. Pre-Install calls Show-ADTInstallationWelcome with -AllowDefer, -DeferTimes 3, -CheckDiskSpace and -PersistPrompt (plus -CloseProcesses when AppProcessesToClose is filled) and shows a progress dialog. Post-Install shows a sample message, which a real package removes or replaces. Pre-Uninstall and Pre-Repair close listed processes with a 60-second countdown.

$adtSession basics

At the top of the script, $adtSession is a plain hashtable. These are the fields of the 4.1.8 template:

powershell · 25 lines
$adtSession = @{
    # App variables.
    AppVendor = ''
    AppName = ''
    AppVersion = ''
    AppArch = ''
    AppLang = 'EN'
    AppRevision = '01'
    AppSuccessExitCodes = @(0)
    AppRebootExitCodes = @(1641, 3010)
    AppProcessesToClose = @()  # Example: @('excel', @{ Name = 'winword'; Description = 'Microsoft Word' })
    AppScriptVersion = '1.0.0'
    AppScriptDate = '2000-12-31'
    AppScriptAuthor = '<author name>'
    RequireAdmin = $true

    # Install Titles (Only set here to override defaults set by the toolkit).
    InstallName = ''
    InstallTitle = ''

    # Script variables.
    DeployAppScriptFriendlyName = $MyInvocation.MyCommand.Name
    DeployAppScriptParameters = $PSBoundParameters
    DeployAppScriptVersion = '4.1.8'
}
FieldMeaning
AppVendor … AppRevisionMetadata; builds the install name and the log name
AppSuccessExitCodes, AppRebootExitCodesExit codes that mean success, or success with a required restart
AppProcessesToCloseNew in 4.1: processes to close, used by all three deployment types
AppScriptVersion, AppScriptDate, AppScriptAuthorWrapper version, date and author, written to the log; New-ADTTemplate sets the date
RequireAdminNew in 4.1: the session fails without administrator rights
InstallName, InstallTitleEmpty: the toolkit builds them
DeployAppScript*Name, parameters and version of the wrapper; not edited

The initialization block removes empty fields from the hashtable, passes the rest to Open-ADTSession and replaces $adtSession with a session object. From then on, $adtSession also exposes values the toolkit has worked out:

PropertyContent
DeploymentType, DeployModeWhat is being done, and in which mode (after the Auto decision)
InstallPhaseThe current phase, for example Pre-Install
DirFiles, DirSupportFilesFull paths of Files\ and SupportFiles\ in the running package
InstallNameBuilt from vendor, name, version, architecture, language and revision
InstallTitleBuilt from vendor, name and version; shown in dialog titles
LogPath, LogNameFolder and file name of the PSADT log

InstallName is joined with underscores from AppVendor, AppName, AppVersion, AppArch, AppLang and AppRevision. Spaces and characters that are invalid in file names are removed, and empty fields are skipped. The PSADT log is then named <InstallName>_PSAppDeployToolkit_<DeploymentType>.log and written to C:\Windows\Logs\Software when the toolkit runs with administrator rights. With AppVendor = 'Igor Pavlov', AppName = '7-Zip', AppVersion = '26.06', AppArch = 'x64', AppLang = 'EN' and AppRevision = '01', an installation logs to:

text
C:\Windows\Logs\Software\IgorPavlov_7-Zip_26.06_x64_EN_01_PSAppDeployToolkit_Install.log

Without administrator rights, the toolkit uses C:\ProgramData\Logs\Software and appends the user name to the file name. Two packages with the same or empty metadata would write to the same log file, which is why the metadata matters.

Warning
If AppName is left empty, the toolkit uses Zero-Config MSI mode: it takes an MSI from Files\, a matching MST and any MSP files, reads vendor, name and version from the MSI and installs it on its own. A package built by hand always sets AppName.

RequireAdmin = $true makes the session fail with exit code 60008 when the process is not elevated; the log starts that error with This deployment requires administrative permissions. Since 4.1, the launcher no longer elevates itself and must be run elevated, as the documentation states. Deployment tools that run as SYSTEM meet this condition; a manual test needs an elevated console.

Deploy modes

-DeployMode controls whether the user sees dialogs. The template default is Auto, with the comment "Don't hard-code this unless required."

ModeBehaviour in 4.1.8
InteractiveAlways shows dialogs and skips the Auto checks. Fails if no user is signed in and the process is not interactive.
NonInteractive"Dialogs without prompts": progress dialogs appear, the welcome dialog and prompts that wait for input do not.
SilentNo dialogs at all.
AutoThe toolkit decides at session start, see below.

In NonInteractive and Silent mode, Show-ADTInstallationWelcome runs silently: processes listed in AppProcessesToClose are closed without asking the user.

According to the 4.1.8 session code, Auto switches to Silent in three cases, checked in this order:

  1. The device has not completed the out-of-box experience, or the user account setup phase of the Enrollment Status Page is still running.
  2. The process runs under a system or service account (the log calls this session 0), no user is signed in, and the process is not interactive.
  3. AppProcessesToClose lists processes and none of them is running.

Otherwise the session continues as Interactive. The log records the decision, for example Installation is running in [Silent] mode. The template's help text describes case 3 the other way round; the code switches to Silent when none of the processes is running.

Warning
In 4.1.8, an explicit -DeployMode Interactive with no signed-in user stops the session ("This deployment explicitly requires interactivity …") and returns the deferral exit code, 1602 by default. For deployments that must also run when nobody is signed in, Silent or Auto is the safer choice. This follows from the 4.1.8 source; the documentation does not describe it.

User interaction in depth (deferrals, countdowns, closing applications) is covered in the advanced course. For this course, Silent and Interactive are enough.

The launcher

Invoke-AppDeployToolkit.exe exists so that deployment tools can start the package with a plain command line. According to the 4.1.8 launcher source, it starts Windows PowerShell 5.1 in a hidden window with -ExecutionPolicy Bypass -NonInteractive -NoProfile -NoLogo and an empty PSModulePath, runs the .ps1 file with its own base name from its folder (Invoke-AppDeployToolkit.ps1) with all other arguments, waits, and returns the script's exit code.

Three launcher switches exist: /Core uses PowerShell 7 (pwsh.exe from the PATH), /32 forces 32-bit Windows PowerShell, and /Debug shows the console output; /32 and /Core together are rejected. Started from a PowerShell 7 console, the launcher uses that pwsh.exe even without /Core. If the launcher itself fails, it returns 60010 or 60011 (exit codes).

The launcher is a Windows application, not a console program, so a console does not wait for it; lessons 4 and 5 use Start-Process -Wait -PassThru.

Note
Microsoft has declared Windows PowerShell 5.1 deprecated in KB5137172 (November 2026). It is still part of Windows and still supported; the KB states that no change is required now. What this means for PSADT packages is described in Windows PowerShell 5.1 Is Deprecated.

Reboot codes and -SuppressRebootPassThru

When the installer returns a reboot code such as 3010, the package passes it on to the caller, and the deployment tool decides how to handle the restart (lesson 6). The switch -SuppressRebootPassThru changes this. The 4.1 documentation describes it in one sentence: "Suppresses return of 3010 'Reboot Required' exit codes and returns 0 instead." In 4.1.8 the switch applies to every code in AppRebootExitCodes, so 1641 also becomes 0. The deployment tool then sees a plain success and is not told that a restart is pending. The restart is still needed: Windows Installer defines 3010 as "A restart is required to complete the install". The command lines in this course leave the switch out, so that the deployment tool receives the restart code.

Common mistakes

SymptomCauseFix
Install-Module or New-ADTTemplate fails with "running scripts is disabled on this system"The execution policy is Restricted, the default on Windows clients; it also blocks module script files (.psm1)Run Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process -Force in the console. A policy set by Group Policy cannot be overridden this way
The package ends with exit code 60008, and its log is in C:\ProgramData\Logs\SoftwareThe console is not elevated. RequireAdmin = $true fails the deployment without administrative privileges, and the launcher does not relaunch itself elevatedRun the test from a console started as administrator
New-ADTTemplate stops with an error instead of creating the packageThe target folder exists and is not emptyChoose a new -Name, or use -Force knowing that it replaces the existing folder
The package installs an MSI from Files\ that no line of the wrapper callsAppName is empty, which activates zero-config modeSet AppName (and the other metadata) in $adtSession

Try it

The goal is a package that installs nothing, writes its own log line and exits cleanly. It is built on PKG01 and tested on CL01.

  1. On the Hyper-V host, apply the checkpoint psadt-L2-start of CL01 and start the VM if it is off. If the checkpoint does not exist yet, apply psadt-L1-end and take it: Checkpoint-VM -Name CL01 -SnapshotName psadt-L2-start. Other hypervisors: the equivalent snapshot. Expected: CL01 is in the clean state from lesson 1. Check: Get-VMCheckpoint -VMName CL01 lists psadt-L2-start.

  2. On PKG01, open Windows PowerShell, allow scripts for this console, install the module and create the package:

    powershell
    # Install PSADT and create an empty package
    Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process -Force
    Install-Module -Name PSAppDeployToolkit -RequiredVersion 4.1.8 -Scope CurrentUser
    New-Item -Path 'C:\Lab\Packages' -ItemType Directory -Force | Out-Null
    New-ADTTemplate -Destination 'C:\Lab\Packages' -Name 'HelloPSADT'

    Alternatively, extract PSAppDeployToolkit_Template_v4.zip from the 4.1.8 release to C:\Lab\Packages\HelloPSADT and unblock the files as shown above. On the first run, Install-Module asks to install the NuGet provider and to confirm the untrusted PSGallery repository; answer Y to both (the second question defaults to N). Expected: module version 4.1.8 is installed and the package folder exists. Check: Get-Module -Name PSAppDeployToolkit -ListAvailable | Select-Object -Property Name, Version shows 4.1.8, and Test-Path -Path 'C:\Lab\Packages\HelloPSADT\Invoke-AppDeployToolkit.ps1' returns True.

  3. Open C:\Lab\Packages\HelloPSADT\Invoke-AppDeployToolkit.ps1 in an editor. Set AppVendor = 'Training', AppName = 'HelloPSADT' and AppVersion = '1.0'. Leave AppArch empty. Expected: the three fields are filled, AppArch is empty. Check: Select-String -Path 'C:\Lab\Packages\HelloPSADT\Invoke-AppDeployToolkit.ps1' -Pattern "AppName = 'HelloPSADT'" -SimpleMatch returns the line.

  4. In Install-ADTDeployment, below the line ## <Perform Installation tasks here>, add:

    powershell
    Write-ADTLogEntry -Message "Hello from phase [$($adtSession.InstallPhase)], files folder [$($adtSession.DirFiles)]."

    Save the file. Expected: the line sits in the Install part of Install-ADTDeployment. Check: Select-String -Path 'C:\Lab\Packages\HelloPSADT\Invoke-AppDeployToolkit.ps1' -Pattern 'Hello from phase' -SimpleMatch returns one line.

  5. Copy the folder C:\Lab\Packages\HelloPSADT from PKG01 to the same path on CL01. CL01 needs neither the module nor a changed execution policy, because the package carries its own copy of the module. Expected: the package is on CL01. Check: on CL01, Test-Path -Path 'C:\Lab\Packages\HelloPSADT\PSAppDeployToolkit' returns True.

  6. On CL01, open Windows PowerShell as administrator and run the package silently:

    powershell
    # Run the wrapper script directly in a child Windows PowerShell process
    Set-Location -Path 'C:\Lab\Packages\HelloPSADT'
    powershell.exe -ExecutionPolicy Bypass -NoProfile -File .\Invoke-AppDeployToolkit.ps1 -DeploymentType Install -DeployMode Silent
    "Exit code: $LASTEXITCODE"

    Expected: the console shows the log lines while the script runs and ends with Exit code: 0.

  7. Open the newest log in C:\Windows\Logs\Software with Notepad or CMTrace. Expected: the file Training_HelloPSADT_1.0_EN_01_PSAppDeployToolkit_Install.log exists. It contains Installation is running in [Silent] mode., the custom line with the phase Install and the full path of the Files folder, and a final line [Training_HelloPSADT_1.0_EN_01] install completed in [...] seconds with exit code [0]. Check: Select-String -Path 'C:\Windows\Logs\Software\Training_HelloPSADT_1.0_EN_01_PSAppDeployToolkit_Install.log' -Pattern 'Hello from phase [Install]' -SimpleMatch returns the custom line.

  8. Optional: repeat step 6 from a console on CL01 that is not elevated. This needs an account that is a local administrator on CL01 but is not the built-in Administrator: with the built-in account, Windows starts every console elevated by default, and in the lab the domain account CORP\Administrator behaved the same way. Starting the console with runas as a different user does not reproduce this case either: in the lab, a run started with runas as a user who was not an administrator on CL01 also ended with 60008, but wrote no log. Expected: exit code 60008; the log is in C:\ProgramData\Logs\Software, with the user name at the end of the file name. Check: Get-ChildItem -Path 'C:\ProgramData\Logs\Software' -Filter 'Training_HelloPSADT*'.

  9. On the host, revert CL01 to psadt-L2-start, then take the checkpoint psadt-L2-end. The package stays on PKG01 for lesson 3. Expected: CL01 is clean again. Check: Get-VMCheckpoint -VMName CL01 lists psadt-L2-end.

Check your understanding

  1. Which two parts of a PSADT package does a packager work with, and which folder is never edited?
Answer

The packager edits Invoke-AppDeployToolkit.ps1 and places the installer in Files\. The PSAppDeployToolkit\ module folder is never edited; New-ADTTemplate marks it read-only, and the documentation says not to modify anything in it.

  1. What are the three phases of the Uninstall deployment type, as written to the log?
Answer

Pre-Uninstall, Uninstall and Post-Uninstall.

  1. A package has AppVendor = 'Example', AppName = 'Example App', AppVersion = '2.1', AppArch = '', AppLang = 'EN', AppRevision = '01'. What is the name of the PSADT log for an uninstall run with administrator rights?
Answer

Example_ExampleApp_2.1_EN_01_PSAppDeployToolkit_Uninstall.log. Spaces are removed and the empty architecture field is skipped.

  1. A package lists 7zFM in AppProcessesToClose and runs with the default deploy mode while 7-Zip is not open. Which mode does the session choose?
Answer

Silent. In Auto mode, 4.1.8 switches to silent when processes to close are defined but none of them is running.

  1. Why does a manual test of a package need an elevated console?
Answer

The template sets RequireAdmin = $true, and since 4.1 the launcher no longer elevates itself. A non-elevated run fails at session start with exit code 60008.

  1. A package runs with -DeployMode NonInteractive while a user is signed in. Which dialogs appear, and how does an explicit -DeployMode Interactive behave on a device where nobody is signed in?
Answer

In NonInteractive mode, only non-interactive elements such as progress dialogs appear; the welcome dialog and prompts that wait for input are skipped, and listed processes are closed without asking. An explicit Interactive run with no signed-in user stops in 4.1.8 and returns the deferral exit code, 1602 by default, which is why Silent or Auto suits deployments that also run when nobody is signed in.

Summary

  • PSADT 4.1.8 comes from the PowerShell Gallery (Install-Module -Name PSAppDeployToolkit -RequiredVersion 4.1.8) or as template ZIPs from the GitHub releases; on Windows clients, scripts must first be allowed for the session.
  • New-ADTTemplate creates a self-contained package: wrapper script, launcher, Files\, SupportFiles\, Assets\, Config\, Strings\ and a read-only copy of the module.
  • Invoke-AppDeployToolkit.ps1 holds one function per deployment type, each with a Pre, main and Post phase; initialization and invocation are not edited.
  • $adtSession starts as metadata and becomes the session object; its fields decide the install name and the log file name.
  • Auto lets the toolkit choose the deploy mode; Silent and Interactive fix it, with the caveat that Interactive needs a signed-in user.
  • The launcher starts Windows PowerShell 5.1 and does not elevate itself; -SuppressRebootPassThru turns a reboot code such as 3010 into 0, so the deployment tool no longer learns about a pending restart.

Sources

Next: Lesson 3: The packager's toolbox

Download the one-pager for this lesson (PDF, 135 KB) ↓