Importing resources for use in DSC

suggest change

Before you can use a resource in a configuration, import it. Installing the module on the authoring computer is not enough for the configuration script to see the resource.

Import a module with Import-DscResource.

This example imports the PSDesiredStateConfiguration module so the configuration can use its File resource.

Configuration InstallPreReqs
{
   param(); # params to DSC goes here.

   Import-DscResource PSDesiredStateConfiguration 

   File CheckForTmpFolder {
        Type = 'Directory'
        DestinationPath = 'C:\Tmp'
        Ensure = "Present"
    }
 }

Note: In order for DSC Resources to work, you must have the modules installed on the target machines when running the configuration. If you don’t have them installed, the configuration will fail.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents