One of our developers uses Task Scheduler to run his programs. The problem comes when the process fails, the task has no idea about this and the task will not be re-triggered. This is the point where a script comes in that checks that the process is running, and if not the task is triggered to start the process. I have come so far:
$taskPath = "\"
Get-ScheduledTask -TaskPath $taskPath |
ForEach-Object { if ($_.actions.execute -match ".exe") {
if ()
the link missing is how do i now connect the task with the process so i can check the state…
Thank you postanote, I was trying to match by Path.
The double backslashes were the missing link, that works, thank you js!
The problem is that I need a property from Get-ScheduledTask that i can then pipe to something that checks if the process is running, however if i need to use double backslashes, i cannot use the Path property to feed Get-CimInstance. I also do not have a Name that i can use. Any suggestions on how i can overcome this?