Author Posts

February 16, 2016 at 2:32 pm

Is it possible to use PowerShell to register a scheduled task with multiple actions?

February 17, 2016 at 9:58 am

Yes, you can specify an array of up to 32 actions.

Quick example with 3 actions:

$actions = @()

$actions += New-ScheduledTaskAction -Execute 'notepad.exe'
$actions += New-ScheduledTaskAction -Execute 'calc.exe'
$actions += New-ScheduledTaskAction -Execute 'taskmgr.exe'

$trigger = New-ScheduledTaskTrigger -Once -At (Get-Date).AddMinutes(1)

$description = 'Test Task'

$task = New-ScheduledTask -Action $actions -Trigger $trigger -Description $description

Register-ScheduledTask TestTask -InputObject $task