I’m assuming I’m doing something wrong here. I have the following (stripped down) ConfigurationData.psd1 file as follows:
@{
AllNodes = @(
@{
NodeName = "*"
PSDscAllowPlainTextPassword = $true
PSDscAllowDomainUser = $true
}
@{
NodeName = "test"
Role = "Blah"
}
)
}
When I run:
$ConfigurationData = Import-PowerShellDataFile -Path C:\Temp\ConfigurationData.psd1
My understanding is that $ConfigurationData should be a hashtable, but it is returning as an array:
PS C:\> $ConfigurationData
Name Value
---- -----
AllNodes {System.Collections.Hashtable, System.Collections.Hashtable}
PS C:\> $ConfigurationData.GetType()
IsPublic IsSerial Name BaseType
-------- -------- ---- --------
True True Object[] System.Array
The few examples of I can find, my ConfigurationData.psd1 is correct. I did read a note on here about not using commas between each hash element - contrary to the MS examples.
I am assuming this is the problem, because when I compile my DSC with
-ConfigurationData $ConfigurationData, I get the error:
Cannot process argument transformation on parameter 'ConfigurationData'. Cannot convert the "System.Object[]" value of type "System.Object[]" to type "System.Collections.Hashtable".
To add to my confusion further, if I set
-ConfigurationData C:\Temp\ConfigurationData.psd1, the DSC compiles without issue, suggesting the problem is not in the ConfigurationData.psd1 file.
Assuming I’m not being an idiot, I wonder if there is a bug in Import-PowerShellDataFile. Therefore, this is running on Windows Server 2012 R2, with PS version 5.1.14409.1005.
Any pointer will be gratefully received.
TIA