Author Posts

October 21, 2016 at 10:15 pm

Hello,
Can you please suggest an optimal way to share common functions among multiple DSC resources?
For instance, I have a logging helper function called "Write-Log" which I need to use from multiple custom DSC resources. So instead of duplicating these kind of logic pieces in multiple places, can I store them in a central place and consume them without repeating myself?
Thanks for your help!

October 22, 2016 at 1:00 pm

Figured out. Never mind. Thanks!

October 22, 2016 at 9:03 pm

I'm bit confused about the static and dynamic variables used in DSC configurations.
I am using private helper functions in my DSC resources. Those are being executed ahead of the time which in my opinion is weird.
For instance in my configuration file i have 2 dsc resources let's say R1 and R2. R2 depends on R1. One of the R2 dsc properties is 'LogMessage' which uses a private function to pull its value instead of a static string. The private function reads a file generated by R1 lets say file1.txt and returns the message string. My script fails stating that the file1.txt doesn't exist. If I remove R2 from the configuration script, it works and file1.txt gets generated.
What am I missing here?

October 28, 2016 at 8:11 am

When you're saying "R2 depends on R1", is that just your logic or did you actually use the DependsOn property ?