I’ve been using PSADT for close to 10 years now and OMFG this is confusing. (Disclaimer: I read the PSADT code, not the PDF manual). This -deployMode 'Silent'
was not there years ago.
According to the source code in AppDeployToolkitMain.ps1, this runs before Deploy-Application.PS1 is processed:
Switch ($deployMode) {
'Silent' { $deployModeSilent = $true }
'NonInteractive' { $deployModeNonInteractive = $true; $deployModeSilent = $true }
Default { $deployModeNonInteractive = $false; $deployModeSilent = $false }
}
Meanwhile, -Silent is also a SWITCH parameter for the Show-InstallationWelcome function:
## Specify whether to prompt user or force close the applications
[Parameter(Mandatory=$false)]
[switch]$Silent = $false,
but $Silent also forcibly set in the code early in the function via:
If ($deployModeNonInteractive) { $Silent = $true }`
So this means if we used -deployMode 'Silent'
to launch Deploy-Application.PS1, $Silent = $false
This is moot because all the logic thereafter uses $deployModeSilent
In the Show-InstallationWelcome function there are 2 key areas that determine whether or not Applications are Closed:
## Prompt the user to close running applications and optionally defer if enabled
If (-not ($deployModeSilent) -and (-not ($silent))) {
and
## Force the processes to close silently, without prompting the user
If (($Silent -or $deployModeSilent) -and $CloseApps) {
There is a bit more code I could post but your heads are probably about to explode, too.
TLDR:
You can CLOSE apps in any $deployMode but to BLOCK the execution of a application, the USER MUST AGREE with a popup. (This is not explained in the PDF, btw.)
When I run the $deployMode = NonInteractive
vs. $deployMode = Silent
in my head here, the manual should actually say:
Silent = No dialogs, also no blocking apps.
NonInteractive = Very silent, i.e. no blocking apps.
Tasha was right. There is no difference.
I personally would not have created 2 new $deployModeXXXXXX variables. I just hope the $deployMode = NonInteractive
vs. $deployMode = Silent
distinction makes sense elsewhere in the PSADT code.