But you want a lot 
Download - as Guy says
PSAppDeployToolkit_Template_v4.zip
SCCM Application
- User Experience (yes/no)
- I would use the Detection Method
Create and customize the template, but you need to know a little more here. I’ve also adjusted the dialog, language, and log.
In SCCM
Install: Invoke-AppDeployToolkit.exe
Repair: Invoke-AppDeployToolkit.exe - DeploymentType “Repair”
Uninstall: Invoke-AppDeployToolkit.exe - DeploymentType “Uninstall”
In principle, you have to follow various rules in SCCM
- No prerequisites - everything in the packages
- No dependencies - you’re just shooting yourself in the foot here
- No removal, you only do this via packages = successor / or via SCCM if there is no successor package
- Requirements on SCCM package and/or task
PSADT per machine
- I remove the control flag
- I uninstall the previous version
- If you start over, you don’t have to relearn the apostrophes and paths (environment variables)
for exe
$MyScript="$($adtSession.DirFiles)\DE\response.varfile"
Start-ADTProcess -FilePath $MyExeFile -ArgumentList "-q -varfile ""$MyScript"""
I have a template for user, bios, per machine installation
here machine msi Invoke-AppDeployToolkit.ps1 adjusted
<#
.SYNOPSIS
PSAppDeployToolkit - This script performs the installation or uninstallation of an application(s).
.DESCRIPTION
- The script is provided as a template to perform an install, uninstall, or repair of an application(s).
- The script either performs an "Install", "Uninstall", or "Repair" deployment type.
- The install deployment type is broken down into 3 main sections/phases: Pre-Install, Install, and Post-Install.
The script imports the PSAppDeployToolkit module which contains the logic and functions required to install or uninstall an application.
PSAppDeployToolkit is licensed under the GNU LGPLv3 License - (C) 2025 PSAppDeployToolkit Team (Sean Lillis, Dan Cunningham, Muhammad Mashwani, Mitch Richters, Dan Gough).
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the
Free Software Foundation, either version 3 of the License, or any later version. This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
.PARAMETER DeploymentType
The type of deployment to perform.
.PARAMETER DeployMode
Specifies whether the installation should be run in Interactive (shows dialogs), Silent (no dialogs), or NonInteractive (dialogs without prompts) mode.
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 Desktop Session Hosts/Citrix servers.
.PARAMETER DisableLogging
Disables logging to file for the script.
.EXAMPLE
powershell.exe -File Invoke-AppDeployToolkit.ps1 -DeployMode Silent
.EXAMPLE
powershell.exe -File Invoke-AppDeployToolkit.ps1 -AllowRebootPassThru
.EXAMPLE
powershell.exe -File Invoke-AppDeployToolkit.ps1 -DeploymentType Uninstall
.EXAMPLE
Invoke-AppDeployToolkit.exe -DeploymentType "Install" -DeployMode "Silent"
.INPUTS
None. You cannot pipe objects to this script.
.OUTPUTS
None. This script does not generate any output.
.NOTES
Toolkit Exit Code Ranges:
- 60000 - 68999: Reserved for built-in exit codes in Invoke-AppDeployToolkit.ps1, and Invoke-AppDeployToolkit.exe
- 69000 - 69999: Recommended for user customized exit codes in Invoke-AppDeployToolkit.ps1
- 70000 - 79999: Recommended for user customized exit codes in PSAppDeployToolkit.Extensions module.
.LINK
https://psappdeploytoolkit.com
#>
[CmdletBinding()]
param
(
[Parameter(Mandatory = $false)]
[ValidateSet('Install', 'Uninstall', 'Repair')]
[PSDefaultValue(Help = 'Install', Value = 'Install')]
[System.String]$DeploymentType,
[Parameter(Mandatory = $false)]
[ValidateSet('Interactive', 'Silent', 'NonInteractive')]
[PSDefaultValue(Help = 'Interactive', Value = 'Interactive')]
[System.String]$DeployMode,
[Parameter(Mandatory = $false)]
[System.Management.Automation.SwitchParameter]$AllowRebootPassThru,
[Parameter(Mandatory = $false)]
[System.Management.Automation.SwitchParameter]$TerminalServerMode,
[Parameter(Mandatory = $false)]
[System.Management.Automation.SwitchParameter]$DisableLogging
)
##================================================
## MARK: Variables
##================================================
$adtSession = @{
##*===============================================
# App variables.
##*===============================================
AppVendor = ''
AppName = ''
AppVersion = ''
AppArch = ''
AppLang = 'EN'
AppRevision = '01'
AppSuccessExitCodes = @(0)
AppRebootExitCodes = @(1641, 3010)
AppScriptVersion = '1.0.0'
AppScriptDate = '2000-12-31'
AppScriptAuthor = 'Toni '
##===============================================
# Install Titles (Only set here to override defaults set by the toolkit).
##===============================================
InstallName = ''
InstallTitle = ''
##===============================================
# Script variables.
DeployAppScriptFriendlyName = $MyInvocation.MyCommand.Name
DeployAppScriptVersion = '4.0.6'
DeployAppScriptParameters = $PSBoundParameters
}
##*===============================================
##* Toni VARIABLE DECLARATION Package
##*===============================================
[string]$appScriptIDNr = ''
# mehrere können nicht per Variablen gelöst werden
[string]$appCloseApp = ''
##*===============================================
##* Toni VARIABLE DECLARATION SystemEnvironment
##*===============================================
[string]$MyFirma=$env:c_Firma
[string]$MyLanguage=$env:c_Sprache
##===============================================
# Install Files
##===============================================
[string]$MyMSIFile ='yourMSI'
[string]$MyMSITransformFile ='yourTransform'
[string]$MyMSITransformFileDE ='yourTransform'
[string]$MyMSITransformFileFR ='yourTransform'
[string]$MyExeFile ='yourExeFile'
# your install Parameter EDITOR_LANGUAGE=de-DE NOUPDATER=1 SET_AS_DEFAULT=0
[string]$MyArgumentList='yourinstallParameter'
[string]$MyArgumentListDE='yourinstallParameter'
[string]$MyArgumentListFR='yourinstallParameter'
# Your MSI ProductName zb. Notepad++
[string]$MyRemove='yourProductname'
##===============================================
function Install-ADTDeployment
{
##================================================
## MARK: Pre-Install
##================================================
$adtSession.InstallPhase = "Pre-$($adtSession.DeploymentType)"
## Show Welcome Message, close Internet Explorer if required, allow up to 3 deferrals, verify there is enough disk space to complete the install, and persist the prompt.
# Show-ADTInstallationWelcome -CloseProcesses iexplore -AllowDefer -DeferTimes 3 -CheckDiskSpace -PersistPrompt
If ($appCloseApp -notlike $Null)
{
# V3.x Show-InstallationWelcome -CloseApps $appCloseApp -AllowDefer -DeferTimes 3 -CheckDiskSpace -PersistPrompt
Show-ADTInstallationWelcome -CloseProcesses $appCloseApp -AllowDefer -DeferTimes 3 -CheckDiskSpace -PersistPrompt
# mehrere können nicht per Variablen gelöst werden
# Show-ADTInstallationWelcome -CloseProcesses @{ Name = 'AcroRd32' }, @{ Name = 'Acrobat' }, @{ Name = 'AcroCEF' } -AllowDefer -DeferTimes 3 -CheckDiskSpace -PersistPrompt
}
## Show Progress Message (with the default message).
Show-ADTInstallationProgress
## <Perform Pre-Installation tasks here>
# ==== Deinstallation der Vorversion - Anzeigename im Add/Remove - DisplayName
# 64-bit Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
# 32-bit Computer\HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall
# V3.x Remove-MSIApplications -Name 'PDF-XChange Editor'
# V4.x Uninstall-ADTApplication -Name 'PDF-XChange Editor' -ApplicationType 'MSI'
# Uninstall-ADTApplication -Name $MyRemove -ApplicationType 'MSI'
Uninstall-ADTApplication -Name $MyRemove -ApplicationType 'MSI'
# V4.x oder per ProductCode - Kontrolle ob es vorhanden ist, muss noch eingebaut werden
# Start-ADTMsiProcess -Action 'Uninstall' -ProductCode '{26923b43-4d38-484f-9b9e-de460746276c}'
##================================================
## MARK: Install
##================================================
$adtSession.InstallPhase = $adtSession.DeploymentType
## Handle Zero-Config MSI installations.
if ($adtSession.UseDefaultMsi)
{
$ExecuteDefaultMSISplat = @{ Action = $adtSession.DeploymentType; FilePath = $adtSession.DefaultMsiFile }
if ($adtSession.DefaultMstFile)
{
$ExecuteDefaultMSISplat.Add('Transform', $adtSession.DefaultMstFile)
}
Start-ADTMsiProcess @ExecuteDefaultMSISplat
if ($adtSession.DefaultMspFiles)
{
$adtSession.DefaultMspFiles | Start-ADTMsiProcess -Action Patch
}
}
##*===============================================
##* Log SystemEnvironment
##*===============================================
Write-ADTLogEntry -Message "==== Client SystemEnvironment"
Write-ADTLogEntry -Message "SystemEnvironment c_Domain : $env:c_Domain"
Write-ADTLogEntry -Message "SystemEnvironment c_Firma : $MyFirma"
Write-ADTLogEntry -Message "SystemEnvironment c_Nova : $env:c_Nova"
Write-ADTLogEntry -Message "SystemEnvironment c_OfficeTemplate: $env:c_OfficeTemplate"
Write-ADTLogEntry -Message "SystemEnvironment c_ProfitCenter : $env:c_ProfitCenter"
Write-ADTLogEntry -Message "SystemEnvironment c_SccmSrv : $env:c_SccmSrv"
Write-ADTLogEntry -Message "SystemEnvironment c_Sprache : $MyLanguage"
Write-ADTLogEntry -Message "SystemEnvironment c_Tastatur : $env:c_Tastatur"
Write-ADTLogEntry -Message "SystemEnvironment c_ThereForeSrv : $env:c_ThereForeSrv"
Write-ADTLogEntry -Message "==== Ende Client SystemEnvironment"
## <Perform Installation tasks here>
Write-ADTLogEntry -Message "Installation"
# V3 Execute-MSI -Path EditorV9.x64.msi -Action Install -AddParameters "EDITOR_LANGUAGE=de-DE NOUPDATER=1 SET_AS_DEFAULT=0" -Transform EditorV9.x64.mst
# V4 Start-ADTMsiProcess -Action 'Install' -FilePath 'EditorV9.x64.msi' -Transforms 'EditorV9.x64.mst' -AdditionalArgumentList "EDITOR_LANGUAGE=de-DE NOUPDATER=1 SET_AS_DEFAULT=0"
# V4 Start-ADTMsiProcess -Action 'Install' -FilePath $MyMSIFile -Transforms $MyMSITransformFile -AdditionalArgumentList $MyArgumentList
Start-ADTMsiProcess -Action 'Install' -FilePath $MyMSIFile
<# ======
$MyKeyFile=$DirFiles+"\1FO8657E-2.xcvault"
# nur Deutsch
if ($MyLanguage -like "de-DE")
{
# V3 Write-Log "Installation nur Deutsch"
# V3 Execute-MSI -Path EditorV9.x64.msi -Action Install -AddParameters "EDITOR_LANGUAGE=de-DE NOUPDATER=1 SET_AS_DEFAULT=1 KEYFILE=`"$MyKeyFile`"" -Transform EditorV9.x64.mst
Write-ADTLogEntry -Message "Installation nur Deutsch"
Start-ADTMsiProcess -Action 'Install' -FilePath $MyMSIFile -Transforms $MyMSITransformFileDE -AdditionalArgumentList $MyArgumentListDE
}
# nur French
if ($MyLanguage -like "fr-Fr" )
{
# V3 Write-Log "Installation nur Französisch"
# V3 Execute-MSI -Path EditorV9.x64.msi -Action Install -AddParameters "EDITOR_LANGUAGE=fr-FR NOUPDATER=1 SET_AS_DEFAULT=1 KEYFILE=`"$MyKeyFile`"" -Transform EditorV9.x64.mst
Write-ADTLogEntry -Message "Installation nur Französisch"
Start-ADTMsiProcess -Action 'Install' -FilePath $MyMSIFile -Transforms $MyMSITransformFileFR -AdditionalArgumentList $MyArgumentListFR
}
====== #>
# ============== Vorversions kontrolle entfernen ===================================
# V3 Remove-RegistryKey -Key 'HKEY_LOCAL_MACHINE\Software\Maintenance\Applications\101130-PDF-XCHANGE-EDITOR-PLUS 9.0.354.0 EN 1.0'
Remove-ADTRegistryKey -Key 'HKEY_LOCAL_MACHINE\Software\Maintenance\Applications\Vorversion'
# =========== Aktualisiert Software Cente =========================================
# Aktualisiert Software Center bzgl. Software
# V3 Invoke-SCCMTask 'SoftwareUpdatesAgentAssignmentEvaluation'
Invoke-ADTSCCMTask 'SoftwareUpdatesAgentAssignmentEvaluation'
##================================================
## MARK: Post-Install
##================================================
$adtSession.InstallPhase = "Post-$($adtSession.DeploymentType)"
## <Perform Post-Installation tasks here>
##*===============================================
##* Log SystemEnvironment
##*===============================================
Write-ADTLogEntry -Message "==== Client SystemEnvironment"
Write-ADTLogEntry -Message "SystemEnvironment c_Domain : $env:c_Domain"
Write-ADTLogEntry -Message "SystemEnvironment c_Firma : $MyFirma"
Write-ADTLogEntry -Message "SystemEnvironment c_Nova : $env:c_Nova"
Write-ADTLogEntry -Message "SystemEnvironment c_OfficeTemplate: $env:c_OfficeTemplate"
Write-ADTLogEntry -Message "SystemEnvironment c_ProfitCenter : $env:c_ProfitCenter"
Write-ADTLogEntry -Message "SystemEnvironment c_SccmSrv : $env:c_SccmSrv"
Write-ADTLogEntry -Message "SystemEnvironment c_Sprache : $MyLanguage"
Write-ADTLogEntry -Message "SystemEnvironment c_Tastatur : $env:c_Tastatur"
Write-ADTLogEntry -Message "SystemEnvironment c_ThereForeSrv : $env:c_ThereForeSrv"
Write-ADTLogEntry -Message "==== Ende Client SystemEnvironment"
# nur Deutsch
if ($MyLanguage -like "de-DE" )
{
$MyMessage="Bitte ab- und anmelden bevor Sie die Applikation nutzen"
}
# nur French
if ($MyLanguage -like "fr-Fr" )
{
$MyMessage="Veuillez vous déconnecter et vous connecter avant d'utiliser l'application"
}
## Display a message at the end of the install.
<# if (!$adtSession.UseDefaultMsi)
{
# Show-ADTInstallationPrompt -Message 'You can customize text to appear at the end of an install or remove it completely for unattended installations.' -ButtonRightText 'OK' -Icon Information -NoWait
Show-ADTInstallationPrompt -Message $MyMessage -ButtonRightText 'OK' -Icon Information -NoWait
} #>
# Doppelt, damit Show-ADTInstallationPrompt sicher nie den Wert $Null hat, welcher den Fehler 60001 bringt
# if ($MyLanguage -notlike "de-DE" -or $MyLanguage -notlike "fr-Fr" ) {$MyMessage="noLanguage"}
if ($MyLanguage -ne "de-DE" -and $MyLanguage -ne "fr-Fr" ) {$MyMessage="noLanguage"}
# ohne der Abfrage, ob ein User angemeldet ist, gibt es die Fehlermeldung 60001, wenn die Dialoge in einer anderen Sprache kommen
$MyUser=(Get-ADTRunAsActiveUser).Username
Write-ADTLogEntry -Message "angemelderter User: $MyUser"
Write-ADTLogEntry -Message "Sprache: $MyLanguage"
Write-ADTLogEntry -Message "$MyMessage"
if ($MyUser) {if (!$adtSession.UseDefaultMsi) {Show-ADTInstallationPrompt -Message $MyMessage -ButtonRightText 'OK' -Icon Information -NoWait} }
}
function Uninstall-ADTDeployment
{
##================================================
## MARK: Pre-Uninstall
##================================================
$adtSession.InstallPhase = "Pre-$($adtSession.DeploymentType)"
## Show Welcome Message, close Internet Explorer with a 60 second countdown before automatically closing.
# Show-ADTInstallationWelcome -CloseProcesses iexplore -CloseProcessesCountdown 60
If ($appCloseApp -notlike $Null)
{
# V3.x Show-InstallationWelcome -CloseApps $appCloseApp -AllowDefer -DeferTimes 3 -CheckDiskSpace -PersistPrompt
# Show-ADTInstallationWelcome -CloseProcesses $appCloseApp -AllowDefer -DeferTimes 3 -CheckDiskSpace -PersistPrompt
Show-ADTInstallationWelcome -CloseProcesses $appCloseApp -CloseProcessesCountdown 60
# mehrere können nicht per Variablen gelöst werden
# Show-ADTInstallationWelcome -CloseProcesses @{ Name = 'AcroRd32' }, @{ Name = 'Acrobat' }, @{ Name = 'AcroCEF' } -CloseProcessesCountdown 60
}
## Show Progress Message (with the default message).
Show-ADTInstallationProgress
## <Perform Pre-Uninstallation tasks here>
##================================================
## MARK: Uninstall
##================================================
$adtSession.InstallPhase = $adtSession.DeploymentType
## Handle Zero-Config MSI uninstallations.
if ($adtSession.UseDefaultMsi)
{
$ExecuteDefaultMSISplat = @{ Action = $adtSession.DeploymentType; FilePath = $adtSession.DefaultMsiFile }
if ($adtSession.DefaultMstFile)
{
$ExecuteDefaultMSISplat.Add('Transform', $adtSession.DefaultMstFile)
}
Start-ADTMsiProcess @ExecuteDefaultMSISplat
}
## <Perform Uninstallation tasks here>
# V3 Execute-Process -Path "C:\Windows\System32\MsiExec.exe" -Parameters "/x `"$dirFiles\RemoteDesktop_1.2.2924.0_x64.msi`" /QN /L* C:\Logfiles\RemoteDesktop_1.2.2924.0_x64-Remove.log"
# V3 Execute-MSI -Path EditorV9.x64.msi -Action Uninstall
Start-ADTMsiProcess -Action 'Uninstall' -FilePath $MyMSIFile
##================================================
## MARK: Post-Uninstallation
##================================================
$adtSession.InstallPhase = "Post-$($adtSession.DeploymentType)"
## <Perform Post-Uninstallation tasks here>
}
function Repair-ADTDeployment
{
##================================================
## MARK: Pre-Repair
##================================================
$adtSession.InstallPhase = "Pre-$($adtSession.DeploymentType)"
## Show Welcome Message, close Internet Explorer with a 60 second countdown before automatically closing.
# Show-ADTInstallationWelcome -CloseProcesses iexplore -CloseProcessesCountdown 60
If ($appCloseApp -notlike $Null)
{
# V3.x Show-InstallationWelcome -CloseApps $appCloseApp -AllowDefer -DeferTimes 3 -CheckDiskSpace -PersistPrompt
Show-ADTInstallationWelcome -CloseProcesses $appCloseApp -AllowDefer -DeferTimes 3 -CheckDiskSpace -PersistPrompt
# mehrere können nicht per Variablen gelöst werden
# Show-ADTInstallationWelcome -CloseProcesses @{ Name = 'AcroRd32' }, @{ Name = 'Acrobat' }, @{ Name = 'AcroCEF' } -AllowDefer -DeferTimes 3 -CheckDiskSpace -PersistPrompt
}
## Show Progress Message (with the default message).
Show-ADTInstallationProgress
## <Perform Pre-Repair tasks here>
##================================================
## MARK: Repair
##================================================
$adtSession.InstallPhase = $adtSession.DeploymentType
## Handle Zero-Config MSI repairs.
if ($adtSession.UseDefaultMsi)
{
$ExecuteDefaultMSISplat = @{ Action = $adtSession.DeploymentType; FilePath = $adtSession.DefaultMsiFile }
if ($adtSession.DefaultMstFile)
{
$ExecuteDefaultMSISplat.Add('Transform', $adtSession.DefaultMstFile)
}
Start-ADTMsiProcess @ExecuteDefaultMSISplat
}
## <Perform Repair tasks here>
# V3 Execute-Process -Path "C:\Windows\System32\MsiExec.exe" -Parameters "/Foums `"$dirFiles\RemoteDesktop_1.2.2924.0_x64.msi`" /QN /L* C:\Logfiles\RemoteDesktop_1.2.2924.0_x64-Repair.log"
# V3 Execute-MSI -Path EditorV9.x64.msi -Action REPAIR
Start-ADTMsiProcess -Action 'Repair' -FilePath $MyMSIFile
##================================================
## MARK: Post-Repair
##================================================
$adtSession.InstallPhase = "Post-$($adtSession.DeploymentType)"
## <Perform Post-Repair tasks here>
}
##================================================
## MARK: Initialization
##================================================
# Set strict error handling across entire operation.
$ErrorActionPreference = [System.Management.Automation.ActionPreference]::Stop
$ProgressPreference = [System.Management.Automation.ActionPreference]::SilentlyContinue
Set-StrictMode -Version 1
# Import the module and instantiate a new session.
try
{
$moduleName = if ([System.IO.File]::Exists("$PSScriptRoot\PSAppDeployToolkit\PSAppDeployToolkit.psd1"))
{
Get-ChildItem -LiteralPath $PSScriptRoot\PSAppDeployToolkit -Recurse -File | Unblock-File -ErrorAction Ignore
"$PSScriptRoot\PSAppDeployToolkit\PSAppDeployToolkit.psd1"
}
else
{
'PSAppDeployToolkit'
}
Import-Module -FullyQualifiedName @{ ModuleName = $moduleName; Guid = '8c3c366b-8606-4576-9f2d-4051144f7ca2'; ModuleVersion = '4.0.6' } -Force
try
{
$iadtParams = Get-ADTBoundParametersAndDefaultValues -Invocation $MyInvocation
$adtSession = Open-ADTSession -SessionState $ExecutionContext.SessionState @adtSession @iadtParams -PassThru
}
catch
{
Remove-Module -Name PSAppDeployToolkit* -Force
throw
}
}
catch
{
$Host.UI.WriteErrorLine((Out-String -InputObject $_ -Width ([System.Int32]::MaxValue)))
exit 60008
}
##================================================
## MARK: Invocation
##================================================
try
{
Get-Item -Path $PSScriptRoot\PSAppDeployToolkit.* | & {
process
{
Get-ChildItem -LiteralPath $_.FullName -Recurse -File | Unblock-File -ErrorAction Ignore
Import-Module -Name $_.FullName -Force
}
}
& "$($adtSession.DeploymentType)-ADTDeployment"
Close-ADTSession
}
catch
{
Write-ADTLogEntry -Message ($mainErrorMessage = Resolve-ADTErrorRecord -ErrorRecord $_) -Severity 3
Show-ADTDialogBox -Text $mainErrorMessage -Icon Stop | Out-Null
Close-ADTSession -ExitCode 60001
}
finally
{
Remove-Module -Name PSAppDeployToolkit* -Force
}
good luck