Which PowerShell DSC Resources Module To Import

Hello!

These three modules all implement various PowerShell DSC resources:

That gives us three top-level Import-DSCResource lines we could use in configurations (check out this article for an in-context example):

Import-DscResource -ModuleName PSDesiredStateConfiguration
Import-DscResource -ModuleName xPSDesiredStateConfiguration
Import-DscResource -ModuleName PSDscResources

Here are the differences:

Here are my standard practices for which to import:

  1. Start with PSDesiredStateConfiguration.
  2. Upgrade to PSDscResources if you need a feature the built-in module doesn’t have.
  3. Test with xPSDesiredStateConfiguration if things still aren’t working. Avoid using this module in production.

Arguably, it’s a good practice to upgrade to PSDscResources by default. I don’t do that because using the built-in module reduces the number of things I have to install and I like short dependency chains. So far, my use-cases have been simple and the built-in module has been sufficient. Your situation may be different.

Happy configuring!

Adam

If this was helpful and you want to save time by getting “copy and paste” patterns for PowerShell in your inbox, subscribe here.