Hi,
I have a ConfigurationData psd1-file.
Inside this file I’m trying to use Get-Content, this because I have an XML-file which contains configuration for a specific component, and I want changes in this file to be documented in our source code repository/a new MOF-file to be compiled when changes are made to it, to get the configuration pushed out when changes are made to this file. Maybe there’s a better way?
However, when I’m trying to compile my MOF-file, I receive the following error:
Error: The command ‘Get-Content’ is not allowed in restricted language mode or a Data section.
This is what the code block looks like in my ConfigurationData:
AppConfiguration = @{ XmlContent = (Get-Content -Path '.\XmlContent.xml') }
Am I not be supposed to be able to use Get-Content in my ConfigurationData, or am I missing something in my code?
I can see that in some examples from Microsoft, they are using this approach in the same way as I’m trying to implement it, so the error I receive is, as you can understand, for me somewhat unexpected.
Your input is, as always, much appreciated.