I have a very strange problem.
A powershell script is to start an exe. It works fine when run manually (right-click > run) or via script call in the powershell console. However, when I create a task in the task scheduler, it does basically create a process with the proper name, but the process is empty and does not do anything. It requires no CPU, the program is not listed in the task bar and the program window does not open. The script basically only contains:
Start-Process -FilePath <Path to exe>
I also tried:
& <path to file>
but that didn't work either. The task starts the program powershell.exe with the parameter
-ExecutionPolicy Unrestricted -Command "& C:\Scripts\MyScript.ps1"
I run it as an admin user and also tried "run with highest privileges" checked. That did not help either.
When I run the task and then start the program manually, it results in two separate processes with the same name but different handles. Usually only one instance of the program can run.
This is apparently a problem with the task scheduler, since the script works fine if run manually. Can anyone help me here?