I have a powershell script that launches an exe process. I have a task scheduled to run this powershell script on computer idle, and I have it set to stop it when it's not idle.
The problem is task schedule doesn't kill the launched exe process, I'm assuming it's just trying to kill the powershell process.
I can't seem to find a way to make the launched exe as a subprocess of a powershell.exe when it's launched from task scheduler
I've tried launching the process with invoke-expression, start-proces, I've also tried to pipe to out-null, wait-process, etc.. nothing seems to work when ps1 is launched from task scheduler.
Is there a way to accomplish this?
Thanks