Close all Apps when using defers

Hi all,
I have the problem while using defers that not all process are killed at once.
I have multiple processes that need to be all killed at once since they have a watcher and will spawn each others if one of it is down.

By using this it works:

Show-InstallationPrompt -Title "Installing FortClient" -Message "The latest version of FortiClient will be installed on your system.
Note that a machine reboot will be required if you had a previous installation.
The installation can be deffered 3 times"  -ButtonRightText "OK" -Icon "Information"

Show-InstallationWelcome -CloseApps 'FortiClient,FortiSettings,FortiSSLVPNdaemon,FortiTray,FortiESNAC' -Silent

But since I want to utilize the defers, I tried the following:

Show-InstallationPrompt -Title "Installing FortClient" -Message "The latest version of FortiClient will be installed on your system.
Note that a machine reboot will be required if you had a previous installation.
The installation can be deffered 3 times"  -ButtonRightText "OK" -Icon "Information"

## Show Welcome Message, Close FortiClient Processes
Show-InstallationWelcome -CloseApps 'FortiClient,FortiSettings,FortiSSLVPNdaemon,FortiTray,FortiESNAC' -AllowDefer -DeferTimes 3

This will result in only the first process to be killed but it will get auto-spawned so quick that the PSADT will re-prompt to close causing a loop since the process respawns so fast.
I tried using -BlockExecution but it never worked.

I tried doing something like:

Show-InstallationPrompt -Title "Installing FortClient" -Message "The latest version of FortiClient will be installed on your system.
Note that a machine reboot will be required if you had a previous installation.
The installation can be deffered 3 times"  -ButtonRightText "OK" -Icon "Information"

Show-InstallationWelcome -AllowDefer -DeferTimes 3
Show-InstallationWelcome -CloseApps 'FortiClient,FortiSettings,FortiSSLVPNdaemon,FortiTray,FortiESNAC' -Silent

But sadly again the respawn is so fast that PSADT couldn’t manage to jump to the silent line and will reprompt on the defer.

How do you guys handle that for multi processes without letting off defers functionality?
I tried to modify the main file to change the behavior into close all apps behavior but so far failed to do so.

Any tips are highly appreciated.

Thanks in Advance!

I’ve never worked with FortiClient stuff but I suspect there is a watchdog process/service that respawns the critical apps. Kill the watchdog first.

You were right. I found the watchdog process. it is configured as a process to auto spawn on startup but it’s just an exe so i couldn’t stop it properly with Stop-Service. I changed the startup type to disabled then killed the process along all other FortiClient processes:

Show-InstallationWelcome -AllowDefer -DeferTimes 3 -MinimizeWindows $False
Set-ServiceStartMode -Name "FA_Scheduler" -StartMode "Disabled"
Show-InstallationWelcome -CloseApps 'FortiClient,FortiSettings,FortiSSLVPNdaemon,FortiTray,FortiESNAC,scheduler' -Silent
1 Like

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