# Check mode for Windows modules

**URL:** <https://forum.ansible.com/t/check-mode-for-windows-modules/21355>\
**Category:** Ansible Project\
**Tags:** windows\
**Created:** [May 4, 2016, 8:01pm UTC](https://forum.ansible.com/t/check-mode-for-windows-modules/21355 "2016-05-04T20:01:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![hodgese](https://avatars.discourse-cdn.com/v4/letter/h/c67d28/32.png) [@hodgese](https://forum.ansible.com/u/hodgese)\
**Post date:** [May 4, 2016, 8:01pm UTC](https://forum.ansible.com/t/check-mode-for-windows-modules/21355/1 "2016-05-04T20:01:22Z")

</div>

Is there a way to implement check mode in a custom Windows module? I didn’t see anything in the documentation about it, and none of the several core modules I checked contained an example.

Thanks,  
Eric

---

<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:** [May 4, 2016, 10:04pm UTC](https://forum.ansible.com/t/check-mode-for-windows-modules/21355/2 "2016-05-04T22:04:48Z")

</div>

There's no reason I can think of why it couldn't be done, but I don't think any core windows modules support check mode at the moment.

Might be worth a check of the extras modules if you are interested in adding support.

I don't particularly miss the lack of check mode. As I have got more familiar with powershell I do sometimes use ansible to run the raw module to check things using a powershell 1 liner. It would be good to have though. Are there specific cases where you would want to use check mode?

Jon

---

<div class="post-metadata">

**Author:** ![Matt\_Davis](https://avatars.discourse-cdn.com/v4/letter/m/ce7236/32.png) [@Matt\_Davis](https://forum.ansible.com/u/Matt_Davis)\
**Post date:** [May 5, 2016, 3:15pm UTC](https://forum.ansible.com/t/check-mode-for-windows-modules/21355/3 "2016-05-05T15:15:55Z")

</div>

Yes, the Windows module API has supported check mode since 2.0. To express your module’s support for check mode, pass $true as the second arg to Parse-Args (supports\_check\_mode). Modules that don’t pass that will exit out with “skipped” from Parse-Args when check mode is requested.

To see if you’re actually in check mode from your module code, look for the module parameter “\_ansible\_check\_mode” to be $true.
