Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#Assuming you already have this hashtable
$MyHashes = @(
@{
Ensure = 'Present'
Name = 'Putty'
Version = 'Latest'
ChocolateyOptions = @{ source = 'https://chocolatey.org/api/v2/' }
},
@{
Ensure = 'Absent'
Name = 'notepadplusplus'
}
)
Configuration MyDscConfig {
$Allnodes.nodename {
#The second Item will error because of missing properties
foreach($MyHash in $MyHashes) {
ChocolateyPackage Putty {
Ensure = $MyHash['Ensure']
Name = $MyHash['Name']
Version = $MyHash['Version']
ChocolateyOptions = $MyHash['ChocolateyOptions']
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment