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”
}
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”
}
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.
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.