Importing resources for use in DSC
suggest changeBefore you can use a resource in a configuration, you must explicitly import it. Just having it installed on your computer, will not let you use the resource implicitly.
Import a resource by using Import-DscResource .
Example showing how to import the PSDesiredStateConfiguration resource and the 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