Passing Data from CSV

Hi,

I need to create multiple groups within a DSC script. Im using a hashtable to pass the data through.

$Nodes = @(
@{NodeName = "TESTWEB01";Role = "IIS";PSDscAllowPlainTextPassword = $true},
@{NodeName = "TESTWEB02";Role = "IIS";PSDscAllowPlainTextPassword = $true},
@{Nodename = "*";Features = "Web-Mgmt-Tools","WEb-Scripting-Tools" , "Web-Mgmt-Service"
})

but i need to add groups to the hashtable that will contain GroupName and Description, whats the best way to achieve this - Could i use

@{Nodename = "*";Features = "Web-Mgmt-Tools","WEb-Scripting-Tools" , "Web-Mgmt-Service;groups=(Get-Content "C:\groups.csv"

Or do i need to add each group to my hashtable as individual key/value pairs?

Thanks

Well… I’d say, “have you tried it?” As written, no, that won’t work. But that’s because you haven’t told PowerShell to actually execute your Get-Content. In double quotes, that’s normally done as a subexpression, a la “blah blah $(Get-Content whatever.txt)”. If I were experimenting, that’s what I’d try first.

Thanks for the reply Don, I didn’t really mean to ask will this work, it’s more whats best? I mean i could just create loads of DSC Group Resources in the script and assign the Name, Description and members, but that doesn’t seem like the best way to do it.

I could populate the hash table with individual groups, but then the hash table would be massive, so i suppose i have answered my own question and should use get-content or import-csv, unless there is a better way?

Thanks