# Creating Scheduled task in windows

**URL:** <https://forum.ansible.com/t/creating-scheduled-task-in-windows/3584>\
**Category:** Get Help\
**Tags:** windows, collections\
**Created:** [February 2, 2024, 11:19am UTC](https://forum.ansible.com/t/creating-scheduled-task-in-windows/3584 "2024-02-02T11:19:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bemuseduser](https://avatars.discourse-cdn.com/v4/letter/b/8e8cbc/32.png) [@bemuseduser](https://forum.ansible.com/u/bemuseduser)\
**Post date:** [February 2, 2024, 11:19am UTC](https://forum.ansible.com/t/creating-scheduled-task-in-windows/3584/1 "2024-02-02T11:19:23Z")

</div>

I am trying to create config that will install a scheduled task. The code as far as I was aware had been working for some time and I just needed to add some more, then the pain started.

I am getting an error message  
“msg”: "failed to set trigger property ‘Repetition’ to ‘System.Collections.Hashtable’: Index was outside the bounds of the array

The relevant element of the code

```auto
triggers:
  - type: daily
    start_boundary: "{{MyVariable}}"
    repetition:
       - interval: PT3H

```

I have tried with and without the leading - in front of the interval

My concerns

1. Repetition is not set its repetition, so is something changing the case somewhere?
2. What does the error actually mean?

I have followed [community.windows.win\_scheduled\_task module – Manage scheduled tasks — Ansible Documentation](https://docs.ansible.com/ansible/latest/collections/community/windows/win_scheduled_task_module.html)

I am about 3 days in trying to understand/fix various issues this is the latest.

I am keen to be pointed towards some useful document that will explain as google has not been fruitful to date.

Thanks

---

<div class="post-metadata">

**Author:** ![kurokobo](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/kurokobo/32/182_2.png) [@kurokobo](https://forum.ansible.com/u/kurokobo)\
**Post date:** [February 2, 2024, 12:51pm UTC](https://forum.ansible.com/t/creating-scheduled-task-in-windows/3584/2 "2024-02-02T12:51:05Z")

</div>

Hi, not tested on my side, but according to the documentation, `repetition` seems to be dict instead of list. So could you please try this:

```yaml
triggers:
  - type: daily
    start_boundary: "{{MyVariable}}"
    repetition:
       # - interval: PT3H
       interval: PT3H

```
