Author Posts

May 14, 2015 at 6:49 pm

Is there a way to delay the variable expansion of a DSC resource, such as the File resource?

Example:

File CopyFile
{
SourcePath = $Source
DestinationPath = "$env:TEMP\File.tmp"
}

May 15, 2015 at 4:29 am

Generally, no. Configuration scripts produce a MOF, which is a static text file. There's no code of any kind in a MOF; everything in the configuration is evaluated when it runs to produce that MOF.

The exception is a Script resource, which bundles PowerShell code into the MOF to be executed on the node.

May 20, 2015 at 6:12 pm

I've run in to this type of issue. I wanted resource A to do work and then resource B to do more work based on the output of A. I ended up taking a module from the gallery and augmenting it to discover the right information on the endpoint node rather than taking a parameter.

Note, the File resource would not be the best candidate for customization, but I do hope to work on xRobocopy as soon as I can make time. 🙂