You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While working with DSC, I use PSD1 files quite a lot; the main use, at present, is
Have a 'RoleInformation.psd1' that details information about a type of server/node. This file is the same irrespective of enviroment (Dev, Test, Staging, Live, etc)
Have a 'NodeData.psd1' that contains a list of servers, collected from the environment listing their name, cert thumbprint and cert path (as each has it's unique cert to use)
Merge the 'RoleInformation' with the 'NodeData' to make an environment specific configuration data document that has expanded all properties for each node.
Because of this use, I am writing out several PSD1 files. The example above is just one use, I also have several libraries of information in PSD1 format so that everything is the same.
I have implemented my own Export-PowerShellDataFile function but it will need work to make it more professional, I'm happy to put it on GitHub and link at a later date for others to judge and perhaps suggest improvements.
I just believe that, with the huge investment in DSC, PowerShell should include a native module for this purpose.
At a high level, my current function provides:
A formatted output of a HashTable (including all tags)
Indentation (parameter based character and number)
I may look to change mine into C# but would welcome any suggestions for a best practice way or achieving a correctly formatted and indented file.
I'd also welcome suggestions on ordering the output. I know you can created ordered hashtables, but if you're reading in from a file where you don't know all of the attributes/properties, you can't create an ordered table from it
Activity
nightroman commentedon Mar 2, 2018
MarvTheRobot (@MarvTheRobot), please take a look at my approach at https://github.com/nightroman/PsdKit
SteveL-MSFT commentedon Oct 29, 2018
Dupe of #2875 (this one is older, but the other had more discussion)