Saving a DSC data file

Hi guys,

So I have a DSC system set up and is working fairly well, however I would like to automate some of the Environment data setup. I have defined my environment data much like the examples in the documentation

I can then read this data like so

$content = (Invoke-Expression(Get-Content $dataFile | Out-String ))

I would like to be able to set some of the details (easy enough) and then write it back to file (not so easy it seems). Does anyone know of any command that will let me serialize it back to a string so it can be written to file in much the same format as in the above documentation example?

There’s nothing natively built-in - I’m not sure this is a use case that the team explicitly planned for.