Resources

Resources are the real work horses in DSC. A resource is really a PowerShell module that provides some functionality to your DSC configurations.

Install Resources

To install resources you basically have to make it available in a directory that is known to PowerShell, in other words, defined in the PSModulePath environment variable.

Update PSModulePath

You can add your custom resource directory to the PSModulePath by invoking the script below or manual editing the variable.

$currentModulePath = [Environment]::GetEnvironmentVariable("PSModulePath", "Machine")
$customModulePath = "C:\_DSC\DSCResources"
$newModulePath = $currentModulePath + ";" + $customModulePath
[Environment]::SetEnvironmentVariable("PSModulePath", $newModulePath, "Machine")

I complicated this script a bit so it is more self evident on what is happening (code as documentation).

Custom Resources

You can create a custom resource to provide functionality not already available in other resources. For example I create an pneInitialize resource to provide common server configuration for all of the nodes in an environment. I prefix with pne which is a custom prefix for the environment I created this resouce for. You will see common prefixes like x, for experimental an c, for community.

A DSC Resource contains

  • Module (psm1)

  • Data (psd1) optional

  • Schema (schema.mof)

http://blogs.msdn.com/b/powershell/archive/2013/11/15/hungry-for-more-windows-powershell-desired-state-configuration-resources.aspx

http://blogs.msdn.com/b/powershell/archive/2013/11/19/resource-designer-tool-a-walkthrough-writing-a-dsc-resource.aspx

http://blogs.msdn.com/b/powershell/archive/2014/05/29/wish-i-can-author-dsc-resource-in-c.aspx

Deploy Resources

http://blogs.msdn.com/b/powershell/archive/2013/12/05/how-to-deploy-and-discover-windows-powershell-desired-state-configuration-resources.aspx

Last updated