Deploy-Application.exe Install Interactive not working when running

Hello,

I have a very specific scenario where I need to run an Application Installation from a Scheduled Task if certain criteria is met.

So not via SCCM or similar software.

The Scheduled Task runs with a different account (domain admin), so not as the currently logged on user.
The problem I’m facing is that the application cannot be run in Interactive Mode.

When I run the Deploy-Application.exe with the same paramteters as the logged on user, it works. Also works when running the Scheduled Task as that user.
But running it as a different user doesn’t display anything.

Error I’m getting in the log file:

[Pre-Installation] :: Error Record:

Message : Exception calling “ShowDialog” with “0” argument(s): “Showing a modal dialog box
or form when the application is not running in UserInteractive mode is not a vali
d operation. Specify the ServiceNotification or DefaultDesktopOnly style to displ
ay a notification from a service application.”
InnerException : System.InvalidOperationException: Showing a modal dialog box or form when the app
lication is not running in UserInteractive mode is not a valid operation. Specify
the ServiceNotification or DefaultDesktopOnly style to display a notification fr
om a service application.
at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
at CallSite.Target(Closure , CallSite , Object )

FullyQualifiedErrorId : InvalidOperationException
ScriptStackTrace : at Show-InstallationPrompt<Process>, \server1\appsources$\Applications\So
ftware\AppDeployToolkit\AppDeployToolkitMain.ps1: line 1576
at <ScriptBlock>, \server1\appsources$\Applications\Software\Depl
oy-Application.ps1: line 117
at <ScriptBlock>, <No file>: line 1
at <ScriptBlock>, <No file>: line 1

PositionMessage : At \server1\appsources$\Applications\Software\AppDeployToolkit\AppDeplo
yToolkitMain.ps1:1576 char:5
+ $result = $formInstallationPrompt.ShowDialog()
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Error Inner Exception(s):

Message : Showing a modal dialog box or form when the application is not running in UserInt
eractive mode is not a valid operation. Specify the ServiceNotification or Defaul
tDesktopOnly style to display a notification from a service application.
InnerException :