# Get user details

**URL:** <https://forum.ansible.com/t/get-user-details/25897>\
**Category:** Ansible Project\
**Created:** [November 2, 2017, 11:09am UTC](https://forum.ansible.com/t/get-user-details/25897 "2017-11-02T11:09:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ravikumar\_Wagh](https://avatars.discourse-cdn.com/v4/letter/r/a183cd/32.png) [@Ravikumar\_Wagh](https://forum.ansible.com/u/Ravikumar_Wagh)\
**Post date:** [November 2, 2017, 11:09am UTC](https://forum.ansible.com/t/get-user-details/25897/1 "2017-11-02T11:09:14Z")

</div>

Is there any way to get available users in system or an spcific user details.

---

<div class="post-metadata">

**Author:** ![Soniya\_panwar](https://avatars.discourse-cdn.com/v4/letter/s/22d042/32.png) [@Soniya\_panwar](https://forum.ansible.com/u/Soniya_panwar)\
**Post date:** [November 7, 2017, 8:16am UTC](https://forum.ansible.com/t/get-user-details/25897/2 "2017-11-07T08:16:49Z")

</div>

hello,

Yes, you can get available users or user details in system by using ansible playbooks. For this you need to use the command / win\_command module.  
“The command module takes the command name followed by a list of space-delimited arguments and executes the given command on all selected nodes.”

If you are trying to retrieve user or user details on a linux system, you may use below playbooks:

1. To get available users in system

- name: get available users in system  
command: cut -d: -f1 /etc/passwd  
register: AvailableUsers

- debug: msg=“{{ AvailableUsers.stdout }}”

1. To get a spcific user details.

- name: get specific user details in system  
command: id username  
register: SpecificUserDetails

- debug: msg=“{{ SpecificUserDetails.stdout }}”

If you are trying to retrieve user or user details on a windows system, you may use below playbooks:

1. To get available users in system

- name: get available users in system  
win\_command: net user  
register: AvailableUsers

- debug: msg=“{{ AvailableUsers.stdout }}”

1. To get a spcific user details.

- name: get specific user details in system  
win\_command: net user username  
register: SpecificUserDetails

- debug: msg=“{{ SpecificUserDetails.stdout }}”

Thanks  
Soniya
