# Ansible Module: win\_scheduled\_task  missing startup trigger

**URL:** <https://forum.ansible.com/t/ansible-module-win-scheduled-task-missing-startup-trigger/24440>\
**Category:** Ansible Project\
**Created:** [May 10, 2017, 12:14am UTC](https://forum.ansible.com/t/ansible-module-win-scheduled-task-missing-startup-trigger/24440 "2017-05-10T00:14:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![JasonV](https://avatars.discourse-cdn.com/v4/letter/j/9de0a6/32.png) [@JasonV](https://forum.ansible.com/u/JasonV)\
**Post date:** [May 10, 2017, 12:14am UTC](https://forum.ansible.com/t/ansible-module-win-scheduled-task-missing-startup-trigger/24440/1 "2017-05-10T00:14:01Z")

</div>

Hi,

I’m pushing a Task Scheduler to a Win2012 server with the ‘win\_scheduled\_task’ module. The task successfully applies however I would like to change the trigger to begin on startup. I don’t see an option with the module to change it to startup. Is using the win\_scheduled\_task my best option?

This is what i’m using.

```auto
- name: MyTaskSchedule
  win_scheduled_task:
     name: "Mytask"
     execute: "PowerShell.exe"
     argument: "-File C:\scripts\MyScript.ps1"

```

---

<div class="post-metadata">

**Author:** ![j.r.hawkesworth](https://avatars.discourse-cdn.com/v4/letter/j/a3d4f5/32.png) [@j.r.hawkesworth](https://forum.ansible.com/u/j.r.hawkesworth)\
**Post date:** [May 16, 2017, 7:22am UTC](https://forum.ansible.com/t/ansible-module-win-scheduled-task-missing-startup-trigger/24440/2 "2017-05-16T07:22:14Z")

</div>

If you want something that starts when the machine does, maybe consider setting up a service, which you can do using the win\_service module: [http://docs.ansible.com/ansible/win\_service\_module.html](http://docs.ansible.com/ansible/win_service_module.html)

It looks like your task scheduler is a powershell script. If so you might need to make some changes to get it to work as a service - I found a page about doing this here: [https://msdn.microsoft.com/en-us/magazine/mt703436.aspx](https://msdn.microsoft.com/en-us/magazine/mt703436.aspx)

Hope this helps,

Jon
