I'm trying to create a task on windows taskscreduler using the powershell but without success. The script I need to create based GUI description:
"At 08:00 every day -After triggered, repeat every 02:00:00 for a duration of 12 hours"
I already found the solution using multiple trigger that could work in this situation:
-Trigger @(New-ScheduledTaskTrigger -Daily -At 8am; New-ScheduledTaskTrigger -Daily -At 10am; New-ScheduledTaskTrigger -Daily -At 12pm; New-ScheduledTaskTrigger -Daily -At 2pm; New-ScheduledTaskTrigger -Daily -At 4pm; New-ScheduledTaskTrigger -Daily -At 6pm; New-ScheduledTaskTrigger -Daily -At 8pm)
But the problem is obvious....in the future if I need a task that run more times a day this script will become a monster. So, someone knows a better solution for that?