Scheduled Task with multiple actions

Welcome Forums General PowerShell Q&A Scheduled Task with multiple actions

This topic contains 1 reply, has 2 voices, and was last updated by

3 years, 2 months ago.

  • Author
  • #35342

    Topics: 12
    Replies: 68
    Points: 9
    Rank: Member

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

  • #35369

    Topics: 1
    Replies: 284
    Points: 41
    Rank: Member

    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

The topic ‘Scheduled Task with multiple actions’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort