# Test only DSC resources

**URL:** <https://forums.powershell.org/t/test-only-dsc-resources/10312>\
**Category:** DSC\
**Created:** [March 16, 2018, 2:04am UTC](https://forums.powershell.org/t/test-only-dsc-resources/10312 "2018-03-16T02:04:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jnury](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/jnury/32/255_2.png) [@jnury](https://forums.powershell.org/u/jnury)\
**Post date:** [March 16, 2018, 2:04am UTC](https://forums.powershell.org/t/test-only-dsc-resources/10312/1 "2018-03-16T02:04:00Z")

</div>

Hi all,

For some use cases, our DSC deployments depend on non-DSC resources (an open TCP port on a remote machine, a version of a remote service etc.).

I wonder if writing a DSC custom resource that just has payload in the Get and Test functions (and an empty Set function) is a good idea or an heresy ? The DSC configuration would fail fast and not deploy anything if prerequisites are not compliants.

Are you aware of such resources in the wild ?

---

<div class="post-metadata">

**Author:** ![michael-greene](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/michael-greene/32/337_2.png) [@michael-greene](https://forums.powershell.org/u/michael-greene)\
**Post date:** [March 16, 2018, 7:07am UTC](https://forums.powershell.org/t/test-only-dsc-resources/10312/2 "2018-03-16T07:07:59Z")

</div>

Here’s a good working example. The Test just returns an immediate true/false regarding the state of the remote thing (in this case AD) and Set manages how long to wait for it to be in the required state and logging. That way you can run test-dscconfiguration without waiting on a timer.

[https://github.com/PowerShell/xActiveDirectory/blob/dev/DSCResources/MSFT\_xWaitForADDomain/MSFT\_xWaitForADDomain.psm1#L78](https://github.com/PowerShell/xActiveDirectory/blob/dev/DSCResources/MSFT_xWaitForADDomain/MSFT_xWaitForADDomain.psm1#L78)

---

<div class="post-metadata">

**Author:** ![jnury](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/jnury/32/255_2.png) [@jnury](https://forums.powershell.org/u/jnury)\
**Post date:** [March 16, 2018, 7:37am UTC](https://forums.powershell.org/t/test-only-dsc-resources/10312/3 "2018-03-16T07:37:25Z")

</div>

Nice example, thank you !

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 9:16pm UTC](https://forums.powershell.org/t/test-only-dsc-resources/10312/4 "2024-05-16T21:16:35Z")

</div>

Closed on May 16, 2024, 9:16pm UTC


