@@ -204,13 +204,13 @@ if ($AdditionalConfiguration) {
204204 #>
205205
206206 $AdditionalConfiguration.GetEnumerator () | ForEach-Object {
207- $c = [System.Collections.Generic.list [string ]]::new()
208- $c .Add (' config' )
209- $c .Add (' set' )
210- $c .Add (" --name='$ ( $_.Key ) '" )
211- $c .Add (" --value='$ ( $_.Value ) '" )
207+ $Config = [System.Collections.Generic.list [string ]]::new()
208+ $Config .Add (' config' )
209+ $Config .Add (' set' )
210+ $Config .Add (" --name='$ ( $_.Key ) '" )
211+ $Config .Add (" --value='$ ( $_.Value ) '" )
212212
213- & choco @c
213+ & choco @Config
214214 }
215215}
216216
@@ -224,18 +224,18 @@ if ($AdditionalFeatures) {
224224 #>
225225 $AdditionalFeatures.GetEnumerator () | ForEach-Object {
226226
227- $c = [System.Collections.Generic.list [string ]]::new()
228- $c .Add (' feature' )
227+ $Feature = [System.Collections.Generic.list [string ]]::new()
228+ $Feature .Add (' feature' )
229229
230230 $state = switch ($_.Value ) {
231231 ' Enabled' { ' enable' }
232232 ' Disabled' { ' disable' }
233233 default { Write-Error ' State must be either Enabled or Disabled' }
234234 }
235235
236- $c .Add ($state )
237- $c .add (" --name='$ ( $_.Key ) '" )
238- & choco @c
236+ $Feature .Add ($state )
237+ $Feature .add (" --name='$ ( $_.Key ) '" )
238+ & choco @Feature
239239 }
240240}
241241
@@ -256,31 +256,31 @@ if ($AdditionalSources) {
256256 CertificatePassword = 's0mepa$$'
257257 }
258258#>
259- Foreach ($a in $AdditionalSources ) {
260- $c = [System.Collections.Generic.List [string ]]::new()
259+ Foreach ($Source in $AdditionalSources ) {
260+ $SourceSplat = [System.Collections.Generic.List [string ]]::new()
261261 # Required items
262- $c .Add (' source' )
263- $c .Add (' add' )
264- $c .Add (" --name='$ ( $a .Name ) '" )
265- $c .Add (" --source='$ ( $a .Source ) '" )
262+ $SourceSplat .Add (' source' )
263+ $SourceSplat .Add (' add' )
264+ $SourceSplat .Add (" --name='$ ( $Source .Name ) '" )
265+ $SourceSplat .Add (" --source='$ ( $Source .Source ) '" )
266266
267267 # Add credentials if source has them
268- if ($a .ContainsKey (' Credentials' )) {
269- $c .Add (" --user='$ ( $a .Credentials.Username ) '" )
270- $c .Add (" --password='$ ( $a .Credentials.GetNetworkCredential ().Password) '" )
268+ if ($Source .ContainsKey (' Credentials' )) {
269+ $SourceSplat .Add (" --user='$ ( $Source .Credentials.Username ) '" )
270+ $SourceSplat .Add (" --password='$ ( $Source .Credentials.GetNetworkCredential ().Password) '" )
271271 }
272272
273273 switch ($true ) {
274- $a [' AllowSelfService' ] { $c .add (' --allow-self-service' ) }
275- $a [' AdminOnly' ] { $c .Add (' --admin-only' ) }
276- $a [' BypassProxy' ] { $c .Add (' --bypass-proxy' ) }
277- $a .ContainsKey (' Priority' ) { $c .Add (" --priority='$ ( $a .Priority ) '" ) }
278- $a .ContainsKey (' Certificate' ) { $c .Add (" --cert='$ ( $a .Certificate ) '" ) }
279- $a .ContainsKey (' CerfificatePassword' ) { $c .Add (" --certpassword='$ ( $a .CertificatePassword ) '" ) }
274+ $Source [' AllowSelfService' ] { $SourceSplat .add (' --allow-self-service' ) }
275+ $Source [' AdminOnly' ] { $SourceSplat .Add (' --admin-only' ) }
276+ $Source [' BypassProxy' ] { $SourceSplat .Add (' --bypass-proxy' ) }
277+ $Source .ContainsKey (' Priority' ) { $SourceSplat .Add (" --priority='$ ( $Source .Priority ) '" ) }
278+ $Source .ContainsKey (' Certificate' ) { $SourceSplat .Add (" --cert='$ ( $Source .Certificate ) '" ) }
279+ $Source .ContainsKey (' CerfificatePassword' ) { $SourceSplat .Add (" --certpassword='$ ( $Source .CertificatePassword ) '" ) }
280280 }
281281 }
282282
283- & choco @c
283+ & choco @SourceValue
284284}
285285
286286if ($AdditionalPackages ) {
@@ -297,19 +297,19 @@ if ($AdditionalPackages) {
297297 #>
298298 foreach ($package in $AdditionalPackages.GetEnumerator ()) {
299299
300- $c = [System.Collections.Generic.list [string ]]::new()
301- $c .add (' install' )
302- $c .add ($package [' Id' ])
300+ $PackageSplat = [System.Collections.Generic.list [string ]]::new()
301+ $PackageSplat .add (' install' )
302+ $PackageSplat .add ($package [' Id' ])
303303
304304 switch ($true ) {
305- $package.ContainsKey (' Version' ) { $c .Add (" --version='$ ( $package.version ) '" ) }
306- $package.ContainsKey (' Pin' ) { $c .Add (' --pin' ) }
305+ $package.ContainsKey (' Version' ) { $PackageSplat .Add (" --version='$ ( $package.version ) '" ) }
306+ $package.ContainsKey (' Pin' ) { $PackageSplat .Add (' --pin' ) }
307307 }
308308
309309 # Ensure packages install and they don't flood the console output
310- $c .Add (' -y' )
311- $c .Add (' --no-progress' )
310+ $PackageSplat .Add (' -y' )
311+ $PackageSplat .Add (' --no-progress' )
312312
313- & choco @c
313+ & choco @PackageSplat
314314 }
315315}
0 commit comments