Scheduled Task to Trigger PSADT/ServiceUI

So, strictly speaking, this isn't actually about Installing something.

There's a particular EXE that needs to run as admin at Login of any user. But even if we have it run with SYSTEM rights in Task Scheduler, it still doesn't seem to work.

If I run it as admin manually or via the terminal as an admin (Or PSEXEC as System) while logged in as a non-admin user it works perfectly fine. Technically speaking, nothing actually appears on the screen, it's just a background process but needs to be run "interactively" with admin rights.

Even tried to get funky with it and get the task to trigger PSADT which only contains a line about launching the exe with Start-ADTProcess. No luck there either.

If I use PSEXec to execute as the System User, that works as well. If I I have a scheduled task trigger the PsExec, it doesn't work.

If I have my PSADT do ServiceUI instead, it works there as well. If I I have a scheduled task trigger the PSADT with ServiceUI, it doesn't work.

The exe itself doesn't even have a GUI. It's just something that runs in the background.

If your EXE does not install anything and needs to run at every user login, why add PSADT in the mix.

Just create a Scheduled task that runs at login time.
Windows Task Scheduler creates event logs at /Applications and Services Logs/Microsoft/Windows/TaskScheduler/Optional to find out WHY it fails.

Maybe that mysterious EXE also creates a log file too.

Task Scheduler by itself can't launch anything interactively that is initiated as SYSTEM. That's why I involved PSADT in the hope that would have an effect but looks like you can't launch anything interactively either with PSADT and Task Scheduler.

PSADT does NOT have "Built-in ServiceUI" or Magic Self-Escalation code.

Your best solution, scary at that, is a Scheduled task that runs ServiceUI.exe to launch your EXE at login time.

I'm not sure if you've tried it but ServiceUI does not launch stuff interactively if executed from Task Scheduler as SYSTEM.

I was hoping that by getting Task Scheduler to run the PSADT which in turn triggers the ServiceUI that it would be "Removed enough from Task Scheduler that it would count as it's own thing.

That should have worked (but I haven't tried it)

You could go for a trifecta: Scheduled task => PSEXec => ServiceUI => YourCrazy.exe but I don't think it will work. you need to read log files and find out why it does work.

Please keep PSADT OUT of this. it won't help