DSCResources/cChocoPackageInstallerSet/cChocoPackageInstallerSet.schema.psm1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
Configuration cChocoPackageInstallerSet { <# .SYNOPSIS Composite DSC Resource allowing you to specify multiple choco packages in a single resource block. #> [CmdletBinding(SupportsShouldProcess=$true)] param ( [parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] [System.String[]] $Name, [ValidateSet('Present','Absent')] [System.String] $Ensure='Present', [parameter(Mandatory = $false)] [ValidateNotNullOrEmpty()] [System.String] $Source ) $addSource = $Source foreach ($pName in $Name) { ## We only need to specify the source one time, ## so we do it only with the first package if ($addSource) { cChocoPackageInstaller "cChocoPackageInstaller_$($Ensure)_$($pName)" { Ensure = $Ensure Name = $pName Source = $Source } $addSource = $null } else { cChocoPackageInstaller "cChocoPackageInstaller_$($Ensure)_$($pName)" { Ensure = $Ensure Name = $pName } } } } |