Skip to content

Commit

Permalink
(#63) Fix request structure and formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
vexx32 committed Jul 24, 2023
1 parent 9bea49f commit 5f26f8e
Showing 1 changed file with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions src/Public/New-CCMDeploymentStep.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -157,15 +157,17 @@ function New-CCMDeploymentStep {
name = $Name
deploymentPlanId = (Get-CCMDeployment -Name $Deployment).id
deploymentStepGroups = @(
Get-CCMGroup -Group $TargetGroup | Select-Object -Property @(
@{ Name = "groupId"; Expression = { $_.id } }
@{ Name = "groupName"; Expression = { $_.name } }
)
if ($TargetGroup) {
Get-CCMGroup -Group $TargetGroup | Select-Object -Property @(
@{ Name = "groupId"; Expression = { $_.id } }
@{ Name = "groupName"; Expression = { $_.name } }
)
}
)
executionTimeoutInSeconds = $ExecutionTimeout
machineContactTimeoutInMinutes = $MachineContactTimeout
requireSuccessOnAllComputers = $RequireSuccessOnAllComputers
failOnError = $FailOnError
requireSuccessOnAllComputers = $RequireSuccessOnAllComputers.IsPresent
failOnError = $FailOnError.IsPresent
validExitCodes = $ValidExitCodes -join ','
script = "{0}|{1}" -f @($ChocoCommand.ToLower(), $PackageName)
} | ConvertTo-Json -Depth 3
Expand All @@ -174,18 +176,20 @@ function New-CCMDeploymentStep {
}
'Advanced' {
$Body = @{
Name = "$Name"
DeploymentPlanId = "$(Get-CCMDeployment -Name $Deployment | Select-Object -ExpandProperty Id)"
Name = $Name
DeploymentPlanId = Get-CCMDeployment -Name $Deployment | Select-Object -ExpandProperty Id
DeploymentStepGroups = @(
Get-CCMGroup -Group $TargetGroup | Select-Object Name, Id | ForEach-Object {
[pscustomobject]@{ groupId = $_.id; groupName = $_.name }
if ($TargetGroup) {
Get-CCMGroup -Group $TargetGroup | Select-Object Name, Id | ForEach-Object {
[pscustomobject]@{ groupId = $_.id; groupName = $_.name }
}
}
)
ExecutionTimeoutInSeconds = "$ExecutionTimeoutSeconds"
RequireSuccessOnAllComputers = "$RequireSuccessOnAllComputers"
failOnError = "$FailOnError"
validExitCodes = "$($validExitCodes -join ',')"
script = "$($Script.ToString())"
ExecutionTimeoutInSeconds = $ExecutionTimeoutSeconds
RequireSuccessOnAllComputers = $RequireSuccessOnAllComputers.IsPresent
failOnError = $FailOnError.IsPresent
validExitCodes = $ValidExitCodes -join ','
script = $Script.ToString()
} | ConvertTo-Json -Depth 3

$Uri = "$($protocol)://$hostname/api/services/app/DeploymentSteps/CreateOrEditPrivileged"
Expand Down

0 comments on commit 5f26f8e

Please sign in to comment.