I need to run the following command with ansible
Set-remotemailbox Test.User -emailaddresses @{Remove="[email protected]"}
I have the following code for Ansible
vars:
_name: Test.User
tasks:
- name: Set Default Email Address For User
ansible.windows.win_shell: |
Set-remotemailbox "{{ _name }}" -emailaddresses @{Remove=\`"'{{ _name }}'@test.e-test.net\`"}
I am following the powershell recommended escaping in this document
https://www.rlmueller.net/PowerShellEscape.htm
Ive tried using win_powershell but the issue seems to be the escaping the Ansible variable and the escaping of the double quotes after the @Remove keyword. Has anyone achieved this or had similar experiences please?