ansible-collections / community.windows

Windows community collection for Ansible
https://galaxy.ansible.com/community/windows
GNU General Public License v3.0
198 stars 153 forks source link

add ObjectGUID field as a return field for win_domain_user module #473

Closed tdavison784 closed 1 year ago

tdavison784 commented 1 year ago
SUMMARY

Would like to have the win_domain_user module also return ObjectGUID of a user as another data field to interact with. We have a few different scenarios were the use of that field is needed, and rather then writing one off win_shell inline powershell commands it would be nice to formalize use with win_domain_user and be able to view the ObjectGUID as a returned element after the task has completed.

ISSUE TYPE
COMPONENT NAME

win_domain_user

ADDITIONAL INFORMATION

In the module return data, add ObjectGUID as one of the returned elements

- name: "Query to gather user details"
  win_domain_user:
    state: "query"
    name: "testUser"
    domain_username: "domainAdmin"
    domain_password: "domainPassword"
  register: user_data

- name: "debug ObjectGUID for testUser"
  debug: msg="{{  user_data.objectguid }}"
jborean93 commented 1 year ago

The win_domain_user module has been deprecated by https://github.com/ansible-collections/community.windows/pull/516 in favour of microsoft.ad.user. See the migration guide for more info on how to change your code to use the newer module.

The microsoft.ad.user module does return the object_guid as well as the distinguished_name and sid return values.