@@ -204,13 +204,13 @@ if ($AdditionalConfiguration) {
204
204
#>
205
205
206
206
$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 ) '" )
212
212
213
- & choco @c
213
+ & choco @Config
214
214
}
215
215
}
216
216
@@ -224,18 +224,18 @@ if ($AdditionalFeatures) {
224
224
#>
225
225
$AdditionalFeatures.GetEnumerator () | ForEach-Object {
226
226
227
- $c = [System.Collections.Generic.list [string ]]::new()
228
- $c .Add (' feature' )
227
+ $Feature = [System.Collections.Generic.list [string ]]::new()
228
+ $Feature .Add (' feature' )
229
229
230
230
$state = switch ($_.Value ) {
231
231
' Enabled' { ' enable' }
232
232
' Disabled' { ' disable' }
233
233
default { Write-Error ' State must be either Enabled or Disabled' }
234
234
}
235
235
236
- $c .Add ($state )
237
- $c .add (" --name='$ ( $_.Key ) '" )
238
- & choco @c
236
+ $Feature .Add ($state )
237
+ $Feature .add (" --name='$ ( $_.Key ) '" )
238
+ & choco @Feature
239
239
}
240
240
}
241
241
@@ -256,31 +256,31 @@ if ($AdditionalSources) {
256
256
CertificatePassword = 's0mepa$$'
257
257
}
258
258
#>
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()
261
261
# 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 ) '" )
266
266
267
267
# 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) '" )
271
271
}
272
272
273
273
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 ) '" ) }
280
280
}
281
281
}
282
282
283
- & choco @c
283
+ & choco @SourceValue
284
284
}
285
285
286
286
if ($AdditionalPackages ) {
@@ -297,19 +297,19 @@ if ($AdditionalPackages) {
297
297
#>
298
298
foreach ($package in $AdditionalPackages.GetEnumerator ()) {
299
299
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' ])
303
303
304
304
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' ) }
307
307
}
308
308
309
309
# 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' )
312
312
313
- & choco @c
313
+ & choco @PackageSplat
314
314
}
315
315
}
0 commit comments