Skip to content

win_scheduled_task: The directory property cannot be found in the cache #621

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
drhirn opened this issue Mar 25, 2025 · 0 comments
Open

Comments

@drhirn
Copy link

drhirn commented Mar 25, 2025

Summary

If using password or logon_type: password execution of the playbook always results in:

FAILED! => {"changed": false, "msg": "failed to modify scheduled task: The directory property cannot be found in the cache.\r\n"}

Issue Type

Bug Report

Component Name

win_scheduled_task

Ansible Version

$ ansible --version

ansible [core 2.16.3]
  config file = /home/.../.ansible.cfg
  configured module search path = ['/home/.../.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.12/site-packages/ansible
  ansible collection location = /home/.../.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.12.8 (main, Dec  9 2024, 15:25:01) [GCC 8.5.0 20210514 (Red Hat 8.5.0-22)] (/usr/bin/python3.12)
  jinja version = 3.1.2
  libyaml = True

Configuration

# if using a version older than ansible-core 2.12 you should omit the '-t all'
$ ansible-config dump --only-changed -t all

CONFIG_FILE() = /home/.../.ansible.cfg
DEFAULT_HOST_LIST(/home/.../.ansible.cfg) = ['/data/ansible_windows/.../inventories']
DEFAULT_VAULT_PASSWORD_FILE(/home/.../.ansible.cfg) = /home/.../.ansible/vault
EDITOR(env: EDITOR) = nano

OS / Environment

Red Hat Enterprise Linux 8.10

Steps to Reproduce

Create a playbook using password and run it

---
- name: Add a scheduled task to remove old temporary files on converter servers
  gather_facts: no
  hosts: all
  tasks:
    - name: Create task
      community.windows.win_scheduled_task:
        name: Clean MSO Content
        description: Löscht Files aus dem Ordnern C:\Users\converteruser\AppData\Local\Microsoft\Windows\INetCache die älter als 30 Tage sind
        date: "2025-03-25T11:42:00"
        author: me
        actions:
          - path: C:\Windows\System32\cscript.exe
            arguments: '"C:\Program Files\CleanLogs\CleanLogs.vbs" "C:\Users\converteruser\AppData\Local\Microsoft\Windows\INetCache" 30'
        triggers:
          - type: daily
            start_boundary: '2025-03-25T01:00:00'
        username: user
        password: password
        run_level: limited
        logon_type: password
        compatibility: 4
        state: present

Expected Results

Expected result would be a new task running under the given user

Actual Results

fatal: [host.example.com]: FAILED! => {
    "changed": true,
    "msg": "failed to modify scheduled task: The directory property cannot be found in the cache.\r\n"
}

The task is created, but only with the correct action. Everything else is missing (author, date, username, password, triggers, ...).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant