I have a need to run an exe during boot but before login, it is basically a batch script converted to exe (the exe is self-encrypting and obfuscated but requires no password to run it). The purpose of this is to instruct VeraCrypt, an encryption software, to mount several non-critical data volumes before any user logs in, so that they will be available by the time the desktop appears.
So far I've tried running this exe via Task Scheduler, trying as both the System and my admin account. Task Scheduler reports that it has ran successfully, but the volumes aren't mounted regardless. VeraCrypt accepts command line input and both my plain bat and converted exe mount the volumes in question when I run it manually. But via Task Scheduler, no go. The point is to have these volumes become available while the system is booting, even if booting takes a bit longer.
I have also tried installing the exe as a service, with RunAsService. The service does run, and under the System account, but again, the volumes are not mounted.
No errors are reported either way.
I have also checked to see if VeraCrypt can be ran as the System user, by launching it with Process Hacker. VeraCrypt reports being ran as admin, but Task Manager shows that it is running as System. I just had to see if the mount failures were due to VeraCrypt possibly not being able to run as the System user.
I also tried running a CMD prompt as the System user, via PsTools. CMD does launch as System, but running the commands in the batch (not the batch itself) don't make the volumes mount either. If I run the same command in a regular admin CMD prompt, the volumes mount fine.
And as long as you specify a few extra switches, the command in the bat will mount the volumes in the background, with no GUI shown or input required from the user. Which, to me, it seems that the mounting bit should be suitable to run as a background service. Even though VeraCrypt's GUI is designed to allow the user to interact and therefore not suitable to run it as a service.
I'm out of ideas, these 2 are the only things I can think of try.