# Windows module helpers functions

**URL:** <https://forum.ansible.com/t/windows-module-helpers-functions/18820>\
**Category:** Ansible Developer\
**Tags:** windows\
**Created:** [July 22, 2015, 1:56pm UTC](https://forum.ansible.com/t/windows-module-helpers-functions/18820 "2015-07-22T13:56:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michael\_Perzel](https://avatars.discourse-cdn.com/v4/letter/m/8491ac/32.png) [@Michael\_Perzel](https://forum.ansible.com/u/Michael_Perzel)\
**Post date:** [July 22, 2015, 1:56pm UTC](https://forum.ansible.com/t/windows-module-helpers-functions/18820/1 "2015-07-22T13:56:08Z")

</div>

Has anyone looked at extending [https://github.com/ansible/ansible/blob/devel/lib/ansible/module\_utils/powershell.ps1](https://github.com/ansible/ansible/blob/devel/lib/ansible/module_utils/powershell.ps1) to provide helper functions to be able to limit a parameter to a set of choices, set parameter as required etc similar to whats available on the linux side of the house? I’m noticing my code for managing parameters is unnecessarily lengthily and could be abstracted out fairly easily.

---

<div class="post-metadata">

**Author:** ![j.r.hawkesworth](https://avatars.discourse-cdn.com/v4/letter/j/a3d4f5/32.png) [@j.r.hawkesworth](https://forum.ansible.com/u/j.r.hawkesworth)\
**Post date:** [July 22, 2015, 2:47pm UTC](https://forum.ansible.com/t/windows-module-helpers-functions/18820/2 "2015-07-22T14:47:29Z")

</div>

Not dug into it but this is a good idea I think.

Need to strike a balance of course as anything in there is going to get added to every module.

---

<div class="post-metadata">

**Author:** ![Michael\_Perzel](https://avatars.discourse-cdn.com/v4/letter/m/8491ac/32.png) [@Michael\_Perzel](https://forum.ansible.com/u/Michael_Perzel)\
**Post date:** [July 23, 2015, 2:00am UTC](https://forum.ansible.com/t/windows-module-helpers-functions/18820/3 "2015-07-23T02:00:04Z")

</div>

Okay I can put together a couple functions and submit a pull request for comment

---

<div class="post-metadata">

**Author:** ![Trond\_Hindenes](https://avatars.discourse-cdn.com/v4/letter/t/96bed5/32.png) [@Trond\_Hindenes](https://forum.ansible.com/u/Trond_Hindenes)\
**Post date:** [July 23, 2015, 11:43am UTC](https://forum.ansible.com/t/windows-module-helpers-functions/18820/4 "2015-07-23T11:43:58Z")

</div>

Thought about it myself, great if you can jump on it.

We already have the “failifempty” param validation, but validation that the param actually contains valid values would be a great addition.

Also (similar to parameterset in PowerShell) we should consider implementing some kind of logic to validate that (“if foo, then also bar is required. if baz then all is good”). If you catch my meaning. That could come later tho.
