Importing resources for use in DSC
suggest changeBefore 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.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents