@@ -156,16 +156,16 @@ function New-CCMDeploymentStep {
156156 $Body = @ {
157157 name = $Name
158158 deploymentPlanId = (Get-CCMDeployment - Name $Deployment ).id
159- deploymentStepGroups = @ (
159+ deploymentStepGroups = [ System.Collections.Generic.List [ psobject ]] @ (
160160 Get-CCMGroup - Group $TargetGroup | Select-Object - Property @ (
161161 @ { Name = " groupId" ; Expression = { $_.id } }
162162 @ { Name = " groupName" ; Expression = { $_.name } }
163163 )
164164 )
165165 executionTimeoutInSeconds = $ExecutionTimeout
166166 machineContactTimeoutInMinutes = $MachineContactTimeout
167- requireSuccessOnAllComputers = $RequireSuccessOnAllComputers
168- failOnError = $FailOnError
167+ requireSuccessOnAllComputers = $RequireSuccessOnAllComputers.IsPresent
168+ failOnError = $FailOnError.IsPresent
169169 validExitCodes = $ValidExitCodes -join ' ,'
170170 script = " {0}|{1}" -f @ ($ChocoCommand.ToLower (), $PackageName )
171171 } | ConvertTo-Json - Depth 3
@@ -174,18 +174,18 @@ function New-CCMDeploymentStep {
174174 }
175175 ' Advanced' {
176176 $Body = @ {
177- Name = " $Name "
178- DeploymentPlanId = " $ ( Get-CCMDeployment - Name $Deployment | Select-Object - ExpandProperty Id) "
179- DeploymentStepGroups = @ (
177+ Name = $Name
178+ DeploymentPlanId = Get-CCMDeployment - Name $Deployment | Select-Object - ExpandProperty Id
179+ DeploymentStepGroups = [ System.Collections.Generic.List [ psobject ]] @ (
180180 Get-CCMGroup - Group $TargetGroup | Select-Object Name, Id | ForEach-Object {
181181 [pscustomobject ]@ { groupId = $_.id ; groupName = $_.name }
182182 }
183183 )
184- ExecutionTimeoutInSeconds = " $ExecutionTimeoutSeconds "
185- RequireSuccessOnAllComputers = " $RequireSuccessOnAllComputers "
186- failOnError = " $FailOnError "
187- validExitCodes = " $ ( $validExitCodes -join ' ,' ) "
188- script = " $ ( $ Script.ToString ()) "
184+ ExecutionTimeoutInSeconds = $ExecutionTimeoutSeconds
185+ RequireSuccessOnAllComputers = $RequireSuccessOnAllComputers.IsPresent
186+ failOnError = $FailOnError.IsPresent
187+ validExitCodes = $ValidExitCodes -join ' ,'
188+ script = $ Script.ToString ()
189189 } | ConvertTo-Json - Depth 3
190190
191191 $Uri = " $ ( $protocol ) ://$hostname /api/services/app/DeploymentSteps/CreateOrEditPrivileged"
0 commit comments