Reputation: 43
I have been creating a few class based custom DSC resources and I am running into the following issue:
Whenever I try to use an array as input for my resource, I get an error.
For example
DscProperty(Mandatory)]
[array]$Products
Would result in the following error when I try to create a MOF file using my resource:
Write-NodeMOFFile : Invalid MOF definition for node 'nodename':
Exceptioncalling "ValidateInstanceText" with "1" argument(s):
"Convert property 'Products' value from type 'STRING[]' to type 'INSTANCE' failed.
The input object for $Products
would be (for example):
$Products = @("Windows server 2012", "Windows SQL Server", "Windows 8.1")
I honestly have no idea why the Write-NodeMOFFile
function would try to convert the array (it should not need converting, right?) and even if it needed to be converted - why would it convert an array from STRING[]
to INSTANCE
?
Anyone has a clue as to why this happens? The only way I got it to work was by creating a long string from my array of strings and then seperating them within the resource.
Upvotes: 1
Views: 1607