community / community.windows / 2.2.0 / module / win_scheduled_task_stat Get information about Windows Scheduled Tasks Authors: Jordan Borean (@jborean93)community.windows.win_scheduled_task_stat (2.2.0) — module
Install with ansible-galaxy collection install community.windows:==2.2.0
collections: - name: community.windows version: 2.2.0
Will return whether the folder and task exists.
Returns the names of tasks in the folder specified.
Use M(community.windows.win_scheduled_task) to configure a scheduled task.
- name: Get information about a folder community.windows.win_scheduled_task_stat: path: \folder name register: task_folder_stat
- name: Get information about a task in the root folder community.windows.win_scheduled_task_stat: name: task name register: task_stat
- name: Get information about a task in a custom folder community.windows.win_scheduled_task_stat: path: \folder name name: task name register: task_stat
name: description: - The name of the scheduled task to get information for. - If C(name) is set and exists, will return information on the task itself. type: str path: default: \ description: The folder path where the task lives. type: str
actions: description: A list of actions. returned: name is specified and task exists sample: - Arguments: /c echo hi Id: null Path: cmd.exe Type: TASK_ACTION_EXEC WorkingDirectory: null type: list folder_exists: description: Whether the folder set at path exists. returned: always sample: true type: bool folder_task_count: description: The number of tasks that exist in the folder. returned: always sample: 2 type: int folder_task_names: description: A list of tasks that exist in the folder. returned: always sample: - Task 1 - Task 2 type: list principal: contains: display_name: description: The name of the user/group that is displayed in the Task Scheduler UI. returned: '' sample: Administrator type: str group_id: description: The group that will run the task. returned: '' sample: BUILTIN\Administrators type: str id: description: The ID for the principal. returned: '' sample: Author type: str logon_type: description: The logon method that the task will run with. returned: '' sample: TASK_LOGON_INTERACTIVE_TOKEN type: str run_level: description: The level of user rights used to run the task. returned: '' sample: TASK_RUNLEVEL_LUA type: str user_id: description: The user that will run the task. returned: '' sample: SERVER\Administrator type: str description: Details on the principal configured to run the task. returned: name is specified and task exists type: complex registration_info: contains: author: description: The author os the task. returned: '' sample: SERVER\Administrator type: str date: description: The date when the task was register. returned: '' sample: '2017-01-01T10:00:00' type: str description: description: The description of the task. returned: '' sample: task description type: str documentation: description: The documentation of the task. returned: '' sample: task documentation type: str security_descriptor: description: The security descriptor of the task. returned: '' sample: security descriptor type: str source: description: The source of the task. returned: '' sample: source type: str uri: description: The URI/path of the task. returned: '' sample: \task\task name type: str version: description: The version of the task. returned: '' sample: 1.0 type: str description: Details on the task registration info. returned: name is specified and task exists type: complex settings: contains: allow_demand_start: description: Whether the task can be started by using either the Run command of the Context menu. returned: '' sample: true type: bool allow_hard_terminate: description: Whether the task can terminated by using TerminateProcess. returned: '' sample: true type: bool compatibility: description: The compatibility level of the task returned: '' sample: 2 type: int delete_expired_task_after: description: The amount of time the Task Scheduler will wait before deleting the task after it expires. returned: '' sample: PT10M type: str disallow_start_if_on_batteries: description: Whether the task will not be started if the computer is running on battery power. returned: '' sample: false type: bool disallow_start_on_remote_app_session: description: Whether the task will not be started when in a remote app session. returned: '' sample: true type: bool enabled: description: Whether the task is enabled. returned: '' sample: true type: bool execution_time_limit: description: The amount of time allowed to complete the task. returned: '' sample: PT72H type: str hidden: description: Whether the task is hidden in the UI. returned: '' sample: false type: bool idle_settings: description: The idle settings of the task. returned: '' sample: idle_duration: PT10M restart_on_idle: false stop_on_idle_end: true wait_timeout: PT1H type: dict maintenance_settings: description: The maintenance settings of the task. returned: '' sample: null type: str mulitple_instances: description: Indicates the behaviour when starting a task that is already running. returned: '' sample: 2 type: int network_settings: description: The network settings of the task. returned: '' sample: id: null name: null type: dict priority: description: The priority level of the task. returned: '' sample: 7 type: int restart_count: description: The number of times that the task will attempt to restart on failures. returned: '' sample: 0 type: int restart_interval: description: How long the Task Scheduler will attempt to restart the task. returned: '' sample: PT15M type: str run_only_id_idle: description: Whether the task will run if the computer is in an idle state. returned: '' sample: true type: bool run_only_if_network_available: description: Whether the task will run only when a network is available. returned: '' sample: false type: bool start_when_available: description: Whether the task can start at any time after its scheduled time has passed. returned: '' sample: false type: bool stop_if_going_on_batteries: description: Whether the task will be stopped if the computer begins to run on battery power. returned: '' sample: true type: bool use_unified_scheduling_engine: description: Whether the task will use the unified scheduling engine. returned: '' sample: false type: bool volatile: description: Whether the task is volatile. returned: '' sample: false type: bool wake_to_run: description: Whether the task will wake the computer when it is time to run the task. returned: '' sample: false type: bool description: Details on the task settings. returned: name is specified and task exists type: complex state: contains: last_run_time: description: The time the registered task was last run. returned: '' sample: '2017-09-20T20:50:00' type: str last_task_result: description: The results that were returned the last time the task was run. returned: '' sample: 267009 type: int next_run_time: description: The time when the task is next scheduled to run. returned: '' sample: '2017-09-20T22:50:00' type: str number_of_missed_runs: description: The number of times a task has missed a scheduled run. returned: '' sample: 1 type: int status: description: The status of the task, whether it is running, stopped, etc. returned: '' sample: TASK_STATE_RUNNING type: str description: Details on the state of the task returned: name is specified and task exists type: complex task_exists: description: Whether the task at the folder exists. returned: name is specified sample: true type: bool triggers: description: A list of triggers. returned: name is specified and task exists sample: - delay: PT15M enabled: true end_boundary: null execution_time_limit: null id: null repetition: duration: null interval: null stop_at_duration_end: false start_boundary: null type: TASK_TRIGGER_BOOT - days_of_month: 5,15,30 enabled: true end_boundary: null execution_time_limit: null id: null months_of_year: june,december random_delay: null repetition: duration: null interval: null stop_at_duration_end: false run_on_last_day_of_month: true start_boundary: '2017-09-20T03:44:38' type: TASK_TRIGGER_MONTHLY type: list