Here’s a quick function to allow you something close to splatting with DSC resources:
Here’s why you may need it.
In DSC, quite often you need to specify a resource with some values like so:
But what if you have an hashtable readily available:
Or if you’re iterating through a list of hashtable, and some don’t contain a value:
Well, until splatting is supported natively in DSC, you could use the following function as a way to support splatting in your configurations:
Be careful in which scope you’re executing this function, because DSC expect the scriptblock invoke in its own scope, not from another module.
But using this trick you can now do something like: