# win\_domain\_computer module

**URL:** <https://forum.ansible.com/t/win-domain-computer-module/32999>\
**Category:** Ansible Project\
**Created:** [May 21, 2020, 9:13pm UTC](https://forum.ansible.com/t/win-domain-computer-module/32999 "2020-05-21T21:13:13Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ramakrishnan\_M](https://avatars.discourse-cdn.com/v4/letter/r/6a8cbe/32.png) [@Ramakrishnan\_M](https://forum.ansible.com/u/Ramakrishnan_M)\
**Post date:** [May 21, 2020, 9:13pm UTC](https://forum.ansible.com/t/win-domain-computer-module/32999/1 "2020-05-21T21:13:13Z")

</div>

Hi Guys,

Why would I get missing parameter error when I use win\_domain\_computer module when the parameter is set as optional.

win\_domain\_computer:  
name: ‘{{ hostname }}’  
register: computer\_account

Errors as…

FAILED! =\> {  
“changed”: false,  
“msg”: “Get-AnsibleParam: Missing required argument: dns\_hostname”  
}

Thanks

---

<div class="post-metadata">

**Author:** ![David\_Foley](https://avatars.discourse-cdn.com/v4/letter/d/9e8a1a/32.png) [@David\_Foley](https://forum.ansible.com/u/David_Foley)\
**Post date:** [May 21, 2020, 10:09pm UTC](https://forum.ansible.com/t/win-domain-computer-module/32999/2 "2020-05-21T22:09:19Z")

</div>

If your looking at doing work on Active Directory; you may need to switch over to "win\_domain\_membership"

---

<div class="post-metadata">

**Author:** ![Ramakrishnan\_M](https://avatars.discourse-cdn.com/v4/letter/r/6a8cbe/32.png) [@Ramakrishnan\_M](https://forum.ansible.com/u/Ramakrishnan_M)\
**Post date:** [May 21, 2020, 10:29pm UTC](https://forum.ansible.com/t/win-domain-computer-module/32999/3 "2020-05-21T22:29:19Z")

</div>

All I need is to get properties of a domain computer- Get-ADComputer. Ansible equivalent win\_domain\_computer.

---

<div class="post-metadata">

**Author:** ![jborean](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/jborean/32/1525_2.png) [@jborean](https://forum.ansible.com/u/jborean)\
**Post date:** [May 22, 2020, 12:39am UTC](https://forum.ansible.com/t/win-domain-computer-module/32999/4 "2020-05-22T00:39:52Z")

</div>

According to the docs, dns\_hostname is

> Required when _state=present_.

So you need to have this set for the module to work.

Thanks

Jordan

---

<div class="post-metadata">

**Author:** ![Ramakrishnan\_M](https://avatars.discourse-cdn.com/v4/letter/r/6a8cbe/32.png) [@Ramakrishnan\_M](https://forum.ansible.com/u/Ramakrishnan_M)\
**Post date:** [May 22, 2020, 1:08am UTC](https://forum.ansible.com/t/win-domain-computer-module/32999/5 "2020-05-22T01:08:54Z")

</div>

I tried that too, if I put State present, it’s asking for ou parameter is required. I want to retrieve it’s OU location. It just keep on asking one by one parameters as required. The documentation page for this module only says name is mandatory parameter, rest is optional.

Get-ADConputer will just work with identity as only parameter required.

Rama

---

<div class="post-metadata">

**Author:** ![jborean](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/jborean/32/1525_2.png) [@jborean](https://forum.ansible.com/u/jborean)\
**Post date:** [May 22, 2020, 3:55am UTC](https://forum.ansible.com/t/win-domain-computer-module/32999/6 "2020-05-22T03:55:29Z")

</div>

> The documentation page for this module only says name is mandatory parameter, rest is optional.

There is only 1 option that is always required ‘name’, but if you read the description you can see that there are multiple others that are required when ‘state=present’.

> I want to retrieve it’s OU location

The module doesn’t look like it will do what you want, it’s designed to enforce a state which requires input. If you want to get the status/info of an existing resource you will have to develop your own win\_domain\_computer\_info module or just use ‘win\_shell: Get-ADComputer’ as you’ve already pointed out only requires the identity.
