Skip to content

Instantly share code, notes, and snippets.

@gaelcolas
Created November 5, 2017 22:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gaelcolas/96cd5ed1d1d5968ff731cb12dfe89751 to your computer and use it in GitHub Desktop.
Save gaelcolas/96cd5ed1d1d5968ff731cb12dfe89751 to your computer and use it in GitHub Desktop.
#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