4.1.0 Closeapp Change - Feedback

Praise to the developers
PSADT 4.1.0
new, where you pass the parameters so that they do not have to be listed individually

AppProcessesToClose = @()  # Example: @('excel', @{ Name = 'winword'; Description = 'Microsoft Word' })
## MARK: Pre-Install
    $saiwParams = @{
        AllowDefer = $true
        DeferTimes = 3
        CheckDiskSpace = $true
        PersistPrompt = $true
    }
 
    if ($adtSession.AppProcessesToClose.Count -gt 0)
    {
        $saiwParams.Add('CloseProcesses', $adtSession.AppProcessesToClose)
    }

    Show-ADTInstallationWelcome @saiwParams 

I just don't understand why you use the same technique for the others. ## MARK: Pre-Uninstall ## MARK: Pre-Repair
I think it's good when you show multiple ways.

 	if ($adtSession.AppProcessesToClose.Count -gt 0)
    {
        Show-ADTInstallationWelcome -CloseProcesses $adtSession.AppProcessesToClose -CloseProcessesCountdown 60
    }

Why 4.2.0 here, new version already planned

The parameter [-NoMinimizeWindows] is obsolete and will be removed in PSAppDeployToolkit 4.2.0.

other windows are no longer minimized

Most people find this a preferable setup. It's just a template though, you can do what you wish.

We can't just remove something without at least one version indicating that it will be so. Of course there's 4.2.0 planned, just have a look at how many feature tickets we have against our 4.2.0 milestone on GitHub.

You can specify -MinimizeWindows if you want the windows minimised. A lot of people found it an annoying default, and it was inconsistent with Show-ADTInstallationPrompt where it was always opt-in.

1 Like

Thanks, it works for me. We received a complaint that it was minimized; apparently, there were problems with poor production software.

If I Run the script manually as an administrator, no error message.
All solutions are in the pre-install, pre-uninstall, and pre-repair templates, and can be customized.

via SCCM
unattended, without user login, error-free = logical, no application is open
with user login, an error occurs
it doesn't matter "NoProcessDetection = $true". i tried it:

[Pre-Install] :: Instantiating user client/server process.	Invoke-ADTClientServerOperation	14.08.2025 17:13:43	2900 (0x0B54)
[Pre-Install] :: Ausnahme beim Aufrufen von "ShowCloseAppsDialog" mit 2 Argument(en):  "The client process returned an exception."
Error Record:
-------------
 
Message               : Ausnahme beim Aufrufen von "ShowCloseAppsDialog" mit 2 Argument(en):  "The client process returned an exception."
InnerException        : PSADT.ClientServer.ServerException: The client process returned an exception. ---> System.ComponentModel.Win32Exception: Zugriff verweigert
                           bei System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited)
                           bei System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited)
                           bei System.Diagnostics.Process.get_HasExited()
                           bei PSADT.ProcessManagement.ProcessUtilities.GetRunningProcesses(IReadOnlyList`1 processDefinitions) in D:\a\PSAppDeployToolkit\PSAppDeployToolkit\src\PSADT\PSADT\ProcessManagement\ProcessUtilities.cs:Zeile 100.
                           bei PSADT.ProcessManagement.RunningProcessService.RefreshCachedProcessLists() in D:\a\PSAppDeployToolkit\PSAppDeployToolkit\src\PSADT\PSADT\ProcessManagement\RunningProcessService.cs:Zeile 105.
                           bei PSADT.ProcessManagement.RunningProcessService.get_ProcessesToClose() in D:\a\PSAppDeployToolkit\PSAppDeployToolkit\src\PSADT\PSADT\ProcessManagement\RunningProcessService.cs:Zeile 153.
                           bei PSADT.UserInterface.DialogManager.ShowCloseAppsDialog(DialogStyle dialogStyle, CloseAppsDialogOptions options, CloseAppsDialogState state) in C:\Repos\PSAppDeployToolkit\src\PSADT\PSADT.UserInterface\DialogManager.cs:Zeile 47.
                           bei PSADT.ClientServer.ClientExecutable.ShowModalDialog(IReadOnlyDictionary`2 arguments, BaseState closeAppsDialogState) in C:\Repos\PSAppDeployToolkit\src\PSADT\PSADT.ClientServer.Client\ClientExecutable.cs:Zeile 492.
                           bei PSADT.ClientServer.ClientExecutable.EnterClientServerMode(ReadOnlyDictionary`2 arguments) in C:\Repos\PSAppDeployToolkit\src\PSADT\PSADT.ClientServer.Client\ClientExecutable.cs:Zeile 310.
                           --- Ende der internen Ausnahmestapelüberwachung ---
                           bei PSADT.ClientServer.ServerInstance.Invoke[T](String command) in C:\Repos\PSAppDeployToolkit\src\PSADT\PSADT.ClientServer.Server\ServerInstance.cs:Zeile 560.
                           bei PSADT.ClientServer.ServerInstance.ShowModalDialog[TResult,TOptions](DialogType dialogType, DialogStyle dialogStyle, TOptions options) in C:\Repos\PSAppDeployToolkit\src\PSADT\PSADT.ClientServer.Server\ServerInstance.cs:Zeile 527.
                           bei PSADT.ClientServer.ServerInstance.ShowCloseAppsDialog(DialogStyle dialogStyle, CloseAppsDialogOptions options) in C:\Repos\PSAppDeployToolkit\src\PSADT\PSADT.ClientServer.Server\ServerInstance.cs:Zeile 218.
                           bei CallSite.Target(Closure , CallSite , Object , String , Object , Object )
 
FullyQualifiedErrorId : ServerException,Show-ADTInstallationWelcome
ScriptStackTrace      : bei Private:Invoke-ADTClientServerOperation, C:\Windows\ccmcache\25\PSAppDeployToolkit\PSAppDeployToolkit.psm1: Zeile 1247
                        bei Show-ADTWelcomePrompt, C:\Windows\ccmcache\25\PSAppDeployToolkit\PSAppDeployToolkit.psm1: Zeile 19125
                        bei Show-ADTInstallationWelcome<Process>, C:\Windows\ccmcache\25\PSAppDeployToolkit\PSAppDeployToolkit.psm1: Zeile 19413
                        bei Install-ADTDeployment, C:\Windows\ccmcache\25\Invoke-AppDeployToolkit.ps1: Zeile 178
                        bei <ScriptBlock>, C:\Windows\ccmcache\25\Invoke-AppDeployToolkit.ps1: Zeile 552
                        bei <ScriptBlock>, <Keine Datei>: Zeile 1
 
PositionMessage       : In C:\Windows\ccmcache\25\Invoke-AppDeployToolkit.ps1:178 Zeichen:5
                        +     Show-ADTInstallationWelcome @saiwParams
                        +     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	Show-ADTInstallationWelcome	14.08.2025 17:13:45	2900 (0x0B54)
[Pre-Install] :: An unhandled error within [Invoke-AppDeployToolkit.ps1] has occurred.
Error Record:
-------------
 
Message               : Ausnahme beim Aufrufen von "ShowCloseAppsDialog" mit 2 Argument(en):  "The client process returned an exception."
InnerException        : PSADT.ClientServer.ServerException: The client process returned an exception. ---> System.ComponentModel.Win32Exception: Zugriff verweigert
                           bei System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited)
                           bei System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited)
                           bei System.Diagnostics.Process.get_HasExited()
                           bei PSADT.ProcessManagement.ProcessUtilities.GetRunningProcesses(IReadOnlyList`1 processDefinitions) in D:\a\PSAppDeployToolkit\PSAppDeployToolkit\src\PSADT\PSADT\ProcessManagement\ProcessUtilities.cs:Zeile 100.
                           bei PSADT.ProcessManagement.RunningProcessService.RefreshCachedProcessLists() in D:\a\PSAppDeployToolkit\PSAppDeployToolkit\src\PSADT\PSADT\ProcessManagement\RunningProcessService.cs:Zeile 105.
                           bei PSADT.ProcessManagement.RunningProcessService.get_ProcessesToClose() in D:\a\PSAppDeployToolkit\PSAppDeployToolkit\src\PSADT\PSADT\ProcessManagement\RunningProcessService.cs:Zeile 153.
                           bei PSADT.UserInterface.DialogManager.ShowCloseAppsDialog(DialogStyle dialogStyle, CloseAppsDialogOptions options, CloseAppsDialogState state) in C:\Repos\PSAppDeployToolkit\src\PSADT\PSADT.UserInterface\DialogManager.cs:Zeile 47.
                           bei PSADT.ClientServer.ClientExecutable.ShowModalDialog(IReadOnlyDictionary`2 arguments, BaseState closeAppsDialogState) in C:\Repos\PSAppDeployToolkit\src\PSADT\PSADT.ClientServer.Client\ClientExecutable.cs:Zeile 492.
                           bei PSADT.ClientServer.ClientExecutable.EnterClientServerMode(ReadOnlyDictionary`2 arguments) in C:\Repos\PSAppDeployToolkit\src\PSADT\PSADT.ClientServer.Client\ClientExecutable.cs:Zeile 310.
                           --- Ende der internen Ausnahmestapelüberwachung ---
                           bei PSADT.ClientServer.ServerInstance.Invoke[T](String command) in C:\Repos\PSAppDeployToolkit\src\PSADT\PSADT.ClientServer.Server\ServerInstance.cs:Zeile 560.
                           bei PSADT.ClientServer.ServerInstance.ShowModalDialog[TResult,TOptions](DialogType dialogType, DialogStyle dialogStyle, TOptions options) in C:\Repos\PSAppDeployToolkit\src\PSADT\PSADT.ClientServer.Server\ServerInstance.cs:Zeile 527.
                           bei PSADT.ClientServer.ServerInstance.ShowCloseAppsDialog(DialogStyle dialogStyle, CloseAppsDialogOptions options) in C:\Repos\PSAppDeployToolkit\src\PSADT\PSADT.ClientServer.Server\ServerInstance.cs:Zeile 218.
                           bei CallSite.Target(Closure , CallSite , Object , String , Object , Object )
 
FullyQualifiedErrorId : ServerException,Show-ADTInstallationWelcome
ScriptStackTrace      : bei Private:Invoke-ADTClientServerOperation, C:\Windows\ccmcache\25\PSAppDeployToolkit\PSAppDeployToolkit.psm1: Zeile 1247
                        bei Show-ADTWelcomePrompt, C:\Windows\ccmcache\25\PSAppDeployToolkit\PSAppDeployToolkit.psm1: Zeile 19125
                        bei Show-ADTInstallationWelcome<Process>, C:\Windows\ccmcache\25\PSAppDeployToolkit\PSAppDeployToolkit.psm1: Zeile 19413
                        bei Install-ADTDeployment, C:\Windows\ccmcache\25\Invoke-AppDeployToolkit.ps1: Zeile 178
                        bei <ScriptBlock>, C:\Windows\ccmcache\25\Invoke-AppDeployToolkit.ps1: Zeile 552
                        bei <ScriptBlock>, <Keine Datei>: Zeile 1
 
PositionMessage       : In C:\Windows\ccmcache\25\Invoke-AppDeployToolkit.ps1:178 Zeichen:5
                        +     Show-ADTInstallationWelcome @saiwParams
                        +     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	Invoke-AppDeployToolkit.ps1	14.08.2025 17:13:45	2900 (0x0B54)
[Finalization] :: Closing user client/server process.	Close-ADTClientServerProcess	14.08.2025 17:13:45	2900 (0x0B54)
[Finalization] :: [100675-Teamviewer-QuickSupportTest] install completed in [4.2763024] seconds with exit code [60001].	Close-ADTSession	14.08.2025 17:13:45	2900 (0x0B54)

This particular issue has been addressed and will be part of 4.1.1, which is releasing today.

1 Like

Thanks, I'll wait then. I just can't promise I'll be able to test it right away. I have some urgent things to take care of.

PSADT 4.1.3
I haven't been able to test everything yet, but I have to say I'm pleased: Close-App now works. I tested it silently on the machine or with the logged-in user. The dialogs appear, or the installation is performed on the machine.

I still have to prepare the Intune test

I would just be interested, on the news you write that SCCM has been bypassed "We have also removed the requirement for the 'Allow users to view and interact with the program installation' checkbox in Configuration Manager deployments"
In order for the dialogs to work for a logged in user, I now have to set NoProcessDetection = $true in the $adtSession hashtable, if I don’t want dialogs, deactivate - right.
Is this the same in Intune ?

$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 = '2025-08-21'
AppScriptAuthor = 'Toni'
RequireAdmin = $true
# So that the Deloy mode can be used like the previous version and the dialogs for the user come
# Note at 4.1.0
# We have also removed the requirement for the 'Allow users to view and interact with the program installation' checkbox in Configuration Manager deployments.
NoProcessDetection = $true

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.