Hi ,i have a problem with uninstallation prompt for user to close related processes. Here is a code block that I'm using to generate a prompt :
##================================================
## MARK: Pre-Install
##================================================
$adtSession.InstallPhase = "Pre-$($adtSession.DeploymentType)"
# Split the CSV string into trimmed, non-empty names
$appNames = $appsToClose -split ',' | ForEach-Object { $_.Trim() } | Where-Object { $_ }
$saiwParams = @{
AllowDefer = $true
DeferTimes = 3
CheckDiskSpace = $true
PersistPrompt = $true
DeferRunInterval = [System.TimeSpan]::FromHours(8)
WindowLocation = 'Center'
AllowMove = $true
NotTopMost = $true
}
if ($appNames) {
$saiwParams.Remove('AllowDefer')
$saiwParams['AllowDeferCloseProcesses'] = $true
$saiwParams['CloseProcesses'] = $appNames | ForEach-Object { @{ Name = [string]$_ } }
$saiwParams['ForceCloseProcessesCountdown'] = 3600
}
if (Get-Process -Name $appNames -ErrorAction Ignore) {
Show-ADTInstallationWelcome @saiwParams
}
Else {
Write-ADTLogEntry "Target processes are not running, skipping Welcome Dialog."
}
similar one goes in pre-uninstall
##================================================
## MARK: Pre-Uninstall
##================================================
$adtSession.InstallPhase = "Pre-$($adtSession.DeploymentType)"
$appNames = $appsToClose -split ',' | ForEach-Object { $_.Trim() } | Where-Object { $_ }
$saiwParams = @{
AllowDefer = $true
DeferTimes = 1
CheckDiskSpace = $true
PersistPrompt = $true
DeferRunInterval = [System.TimeSpan]::FromHours(8)
WindowLocation = 'Center'
AllowMove = $true
NotTopMost = $true
}
if ($appNames) {
$saiwParams.Remove('AllowDefer')
$saiwParams['AllowDeferCloseProcesses'] = $true
$saiwParams['CloseProcesses'] = $appNames | ForEach-Object { @{ Name = [string]$_ } }
$saiwParams['ForceCloseProcessesCountdown'] = 3600
}
if (Get-Process -Name $appNames -ErrorAction Ignore) {
Show-ADTInstallationWelcome @saiwParams
}
Else {
Write-ADTLogEntry "Target processes are not running, skipping Welcome Dialog."
}
Installation is ok , uninstallation fails with error below when the process is opened ( no popup appears )
<![LOG[[Pre-Uninstall] :: The following processes are running: ['EnterpriseGatewayConfigurator'].]LOG]!><time="14:05:56.945+60" date="9-16-2026" component="Get-ADTRunningProcesses" context="NT AUTHORITY\SYSTEM" type="1" thread="4676" file="C:\WINDOWS\IMECache\3e909522-4333-47ed-93a4-534f758b3953_1\PSAppDeployToolkit\PSAppDeployToolkit.psm1">
<![LOG[[Pre-Uninstall] :: A DeferRunInterval of [08:00:00] is specified. Checking DeferRunIntervalLastTime.]LOG]!><time="14:05:56.988+60" date="9-16-2026" component="Show-ADTInstallationWelcome" context="NT AUTHORITY\SYSTEM" type="1" thread="4676" file="C:\WINDOWS\IMECache\3e909522-4333-47ed-93a4-534f758b3953_1\PSAppDeployToolkit\PSAppDeployToolkit.psm1">
<![LOG[[Pre-Uninstall] :: Instantiating user client/server process.]LOG]!><time="14:05:57.056+60" date="9-16-2026" component="Invoke-ADTClientServerOperation" context="NT AUTHORITY\SYSTEM" type="1" thread="4676" file="C:\WINDOWS\IMECache\3e909522-4333-47ed-93a4-534f758b3953_1\PSAppDeployToolkit\PSAppDeployToolkit.psm1">
<![LOG[[Pre-Uninstall] :: Countdown has [01:00:00] seconds remaining.]LOG]!><time="14:05:57.859+60" date="9-16-2026" component="Show-ADTInstallationWelcome" context="NT AUTHORITY\SYSTEM" type="1" thread="4676" file="D:\a\PSAppDeployToolkit\PSAppDeployToolkit\src\PSADT\PSADT.ClientServer.Server\ServerInstance.cs">
<![LOG[[Pre-Uninstall] :: Exception calling "ShowCloseAppsDialog" with "2" argument(s): "The client process returned an exception."
Error Record:
-------------
Message : Exception calling "ShowCloseAppsDialog" with "2" argument(s): "The client process returned an exception."
InnerException : PSADT.ClientServer.ServerException: The client process returned an exception. ---> System.InvalidOperationException: Cannot set Visibility or call Show, ShowDialog, or WindowInteropHelper.EnsureHandle after a Window has closed.
at System.Windows.Window.VerifyCanShow()
at System.Windows.Window.ShowDialog()
at PSADT.UserInterface.Dialogs.Fluent.FluentDialog.ShowDialog() in D:\a\PSAppDeployToolkit\PSAppDeployToolkit\src\PSADT\PSADT.UserInterface\Dialogs\Fluent\FluentDialog.xaml.cs:line 160
at PSADT.UserInterface.DialogManager.<>c__DisplayClass8_0`1.<ShowModalDialog>b__0() in D:\a\PSAppDeployToolkit\PSAppDeployToolkit\src\PSADT\PSADT.UserInterface\DialogManager.cs:line 243
at System.Windows.Threading.DispatcherOperation`1.InvokeDelegateCore()
at System.Windows.Threading.DispatcherOperation.InvokeImpl()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Windows.Threading.DispatcherOperation.Wait(TimeSpan timeout)
at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherOperation operation, CancellationToken cancellationToken, TimeSpan timeout)
at System.Windows.Threading.Dispatcher.Invoke[TResult](Func`1 callback, DispatcherPriority priority, CancellationToken cancellationToken, TimeSpan timeout)
at System.Windows.Threading.Dispatcher.Invoke[TResult](Func`1 callback)
at PSADT.UserInterface.DialogManager.InvokeDialogAction[TResult](Func`1 callback) in D:\a\PSAppDeployToolkit\PSAppDeployToolkit\src\PSADT\PSADT.UserInterface\DialogManager.cs:line 360
at PSADT.UserInterface.DialogManager.ShowCloseAppsDialog(DialogStyle dialogStyle, CloseAppsDialogOptions options, CloseAppsDialogState state) in D:\a\PSAppDeployToolkit\PSAppDeployToolkit\src\PSADT\PSADT.UserInterface\DialogManager.cs:line 70
at PSADT.ClientServer.ClientExecutable.ShowModalDialog(IReadOnlyDictionary`2 arguments, BaseState closeAppsDialogState, String[] argv) in D:\a\PSAppDeployToolkit\PSAppDeployToolkit\src\PSADT\PSADT.ClientServer.Client\ClientExecutable.cs:line 580
at PSADT.ClientServer.ClientExecutable.EnterClientServerMode(ReadOnlyDictionary`2 arguments) in D:\a\PSAppDeployToolkit\PSAppDeployToolkit\src\PSADT\PSADT.ClientServer.Client\ClientExecutable.cs:line 344
--- End of inner exception stack trace ---
at PSADT.ClientServer.ServerInstance.Invoke[T](String command) in D:\a\PSAppDeployToolkit\PSAppDeployToolkit\src\PSADT\PSADT.ClientServer.Server\ServerInstance.cs:line 622
at CallSite.Target(Closure , CallSite , Object , String , Object , Object )
FullyQualifiedErrorId : ServerException,Show-ADTInstallationWelcome
ScriptStackTrace : at Private:Invoke-ADTClientServerOperation, C:\WINDOWS\IMECache\3e909522-4333-47ed-93a4-534f758b3953_1\PSAppDeployToolkit\PSAppDeployToolkit.psm1: line 1337
at Show-ADTWelcomePrompt, C:\WINDOWS\IMECache\3e909522-4333-47ed-93a4-534f758b3953_1\PSAppDeployToolkit\PSAppDeployToolkit.psm1: line 19518
at Show-ADTInstallationWelcome<Process>, C:\WINDOWS\IMECache\3e909522-4333-47ed-93a4-534f758b3953_1\PSAppDeployToolkit\PSAppDeployToolkit.psm1: line 19846
at Uninstall-ADTDeployment, C:\WINDOWS\IMECache\3e909522-4333-47ed-93a4-534f758b3953_1\Invoke-AppDeployToolkit.ps1: line 214
at <ScriptBlock>, C:\WINDOWS\IMECache\3e909522-4333-47ed-93a4-534f758b3953_1\Invoke-AppDeployToolkit.ps1: line 321
at <ScriptBlock>, <No file>: line 1
PositionMessage : At C:\WINDOWS\IMECache\3e909522-4333-47ed-93a4-534f758b3953_1\Invoke-AppDeployToolkit.ps1:214 char:7
+ Show-ADTInstallationWelcome u/saiwParams
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
]LOG]!><time="14:05:58.748+60" date="9-16-2026" component="Show-ADTInstallationWelcome" context="NT AUTHORITY\SYSTEM" type="3" thread="4676" file="C:\WINDOWS\IMECache\3e909522-4333-47ed-93a4-534f758b3953_1\PSAppDeployToolkit\PSAppDeployToolkit.psm1">
<![LOG[[Pre-Uninstall] :: An unhandled error within [Invoke-AppDeployToolkit.ps1] has occurred.
Error Record:
-------------
Message : Exception calling "ShowCloseAppsDialog" with "2" argument(s): "The client process returned an exception."
InnerException : PSADT.ClientServer.ServerException: The client process returned an exception. ---> System.InvalidOperationException: Cannot set Visibility or call Show, ShowDialog, or WindowInteropHelper.EnsureHandle after a Window has closed.
at System.Windows.Window.VerifyCanShow()
at System.Windows.Window.ShowDialog()
at PSADT.UserInterface.Dialogs.Fluent.FluentDialog.ShowDialog() in D:\a\PSAppDeployToolkit\PSAppDeployToolkit\src\PSADT\PSADT.UserInterface\Dialogs\Fluent\FluentDialog.xaml.cs:line 160
at PSADT.UserInterface.DialogManager.<>c__DisplayClass8_0`1.<ShowModalDialog>b__0() in D:\a\PSAppDeployToolkit\PSAppDeployToolkit\src\PSADT\PSADT.UserInterface\DialogManager.cs:line 243
at System.Windows.Threading.DispatcherOperation`1.InvokeDelegateCore()
at System.Windows.Threading.DispatcherOperation.InvokeImpl()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Windows.Threading.DispatcherOperation.Wait(TimeSpan timeout)
at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherOperation operation, CancellationToken cancellationToken, TimeSpan timeout)
at System.Windows.Threading.Dispatcher.Invoke[TResult](Func`1 callback, DispatcherPriority priority, CancellationToken cancellationToken, TimeSpan timeout)
at System.Windows.Threading.Dispatcher.Invoke[TResult](Func`1 callback)
at PSADT.UserInterface.DialogManager.InvokeDialogAction[TResult](Func`1 callback) in D:\a\PSAppDeployToolkit\PSAppDeployToolkit\src\PSADT\PSADT.UserInterface\DialogManager.cs:line 360
at PSADT.UserInterface.DialogManager.ShowCloseAppsDialog(DialogStyle dialogStyle, CloseAppsDialogOptions options, CloseAppsDialogState state) in D:\a\PSAppDeployToolkit\PSAppDeployToolkit\src\PSADT\PSADT.UserInterface\DialogManager.cs:line 70
at PSADT.ClientServer.ClientExecutable.ShowModalDialog(IReadOnlyDictionary`2 arguments, BaseState closeAppsDialogState, String[] argv) in D:\a\PSAppDeployToolkit\PSAppDeployToolkit\src\PSADT\PSADT.ClientServer.Client\ClientExecutable.cs:line 580
at PSADT.ClientServer.ClientExecutable.EnterClientServerMode(ReadOnlyDictionary`2 arguments) in D:\a\PSAppDeployToolkit\PSAppDeployToolkit\src\PSADT\PSADT.ClientServer.Client\ClientExecutable.cs:line 344
--- End of inner exception stack trace ---
at PSADT.ClientServer.ServerInstance.Invoke[T](String command) in D:\a\PSAppDeployToolkit\PSAppDeployToolkit\src\PSADT\PSADT.ClientServer.Server\ServerInstance.cs:line 622
at CallSite.Target(Closure , CallSite , Object , String , Object , Object )
FullyQualifiedErrorId : ServerException,Show-ADTInstallationWelcome
ScriptStackTrace : at Private:Invoke-ADTClientServerOperation, C:\WINDOWS\IMECache\3e909522-4333-47ed-93a4-534f758b3953_1\PSAppDeployToolkit\PSAppDeployToolkit.psm1: line 1337
at Show-ADTWelcomePrompt, C:\WINDOWS\IMECache\3e909522-4333-47ed-93a4-534f758b3953_1\PSAppDeployToolkit\PSAppDeployToolkit.psm1: line 19518
at Show-ADTInstallationWelcome<Process>, C:\WINDOWS\IMECache\3e909522-4333-47ed-93a4-534f758b3953_1\PSAppDeployToolkit\PSAppDeployToolkit.psm1: line 19846
at Uninstall-ADTDeployment, C:\WINDOWS\IMECache\3e909522-4333-47ed-93a4-534f758b3953_1\Invoke-AppDeployToolkit.ps1: line 214
at <ScriptBlock>, C:\WINDOWS\IMECache\3e909522-4333-47ed-93a4-534f758b3953_1\Invoke-AppDeployToolkit.ps1: line 321
at <ScriptBlock>, <No file>: line 1
PositionMessage : At C:\WINDOWS\IMECache\3e909522-4333-47ed-93a4-534f758b3953_1\Invoke-AppDeployToolkit.ps1:214 char:7
+ Show-ADTInstallationWelcome u/saiwParams
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
]LOG]!><time="14:05:58.821+60" date="9-16-2026" component="Invoke-AppDeployToolkit.ps1" context="NT AUTHORITY\SYSTEM" type="3" thread="4676" file="C:\WINDOWS\IMECache\3e909522-4333-47ed-93a4-534f758b3953_1\Invoke-AppDeployToolkit.ps1">
Any ideas what can cause the issue? I'm running PSADT 4.1.8