Ansible: 2.9 Windows: W2k16 Server

I'm searching for a method to register (log) Ansible actions in remote Windows host.

For example, when I work with win_command module for echo test command, I can't find lines referring to this action in Windows Event Log.

How can I make the ansible actions show up in the Windows Event log?

  • 1
    What are the specific lines you are expecting, and what lines are produced?
    – Greg Askew
    Apr 4, 2022 at 11:26
  • _ In to "Windows Events" I like found "Ansible_user launch command: echo test" with stdout: "The result command".
    – CH06
    Apr 4, 2022 at 12:07

1 Answer 1


I understand your question that you like to Register and log Return Values from win_command in Windows Event Log.

You could use win_eventlog_entry – Write entries to Windows event logs and something like

- name: Save the result of 'whoami' in 'result'
  ansible.windows.win_command: whoami
  register: result

- name: Write 'result.stdout' to Windows Event Log
    log: Result of win_command
    source: Ansible module win_command
    event_id: 1234
    message: "{{ result.stdout }}"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.