# copy active directory user

**URL:** <https://forum.ansible.com/t/copy-active-directory-user/34163>\
**Category:** Ansible Project\
**Tags:** windows\
**Created:** [November 6, 2020, 10:41am UTC](https://forum.ansible.com/t/copy-active-directory-user/34163 "2020-11-06T10:41:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nicolas\_Talvasson](https://avatars.discourse-cdn.com/v4/letter/n/ccd318/32.png) [@Nicolas\_Talvasson](https://forum.ansible.com/u/Nicolas_Talvasson)\
**Post date:** [November 6, 2020, 10:41am UTC](https://forum.ansible.com/t/copy-active-directory-user/34163/1 "2020-11-06T10:41:53Z")

</div>

Hi  
I found how to create a new user in my Windows active directory with ansible, but we usually copy a, existing in order to add the group needed more easyly

Is there a similiare possibility to copy an existing user with all the specification and just modify first name and last name and password

Thanks  
Nicolas

---

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [November 6, 2020, 10:59am UTC](https://forum.ansible.com/t/copy-active-directory-user/34163/2 "2020-11-06T10:59:45Z")

</div>

I have no idea what you current playbook looks like, and I have not  
used ansible to manage Windows, so I am going to assume you are using  
the win\_domain\_user module to create a user.  
Looking at the docs, the 'state' parameter accepts a 'query' value:

[https://docs.ansible.com/ansible/2.9/modules/win\_domain\_user\_module.html#parameter-state](https://docs.ansible.com/ansible/2.9/modules/win_domain_user_module.html#parameter-state)

I would do something like this:

- win\_domain\_user to query existing user, and register result  
- set\_fact to change only a few value in that data structure  
- win\_domain\_user to create a new users with that data structure

---

<div class="post-metadata">

**Author:** ![Nicolas\_Talvasson](https://avatars.discourse-cdn.com/v4/letter/n/ccd318/32.png) [@Nicolas\_Talvasson](https://forum.ansible.com/u/Nicolas_Talvasson)\
**Post date:** [November 6, 2020, 3:07pm UTC](https://forum.ansible.com/t/copy-active-directory-user/34163/3 "2020-11-06T15:07:41Z")

</div>

thanks i will search in this direction
