Skip to content

Commit 2073d14

Browse files
Merge branch 'dev' of https://github.com/KelvinTegelaar/CIPP-API into dev
2 parents e1b58fc + ff2e443 commit 2073d14

2 files changed

Lines changed: 29 additions & 9 deletions

File tree

Modules/CIPPCore/Public/Compare-CIPPIntuneObject.ps1

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -277,29 +277,45 @@ function Compare-CIPPIntuneObject {
277277
($Object2 -is [Array] -or $Object2 -is [System.Collections.IList])) {
278278
continue
279279
}
280-
if ($Object1.$propName -and $Object2.$propName) {
281-
Compare-ObjectsRecursively -Object1 $Object1.$propName -Object2 $Object2.$propName -PropertyPath $newPath -Depth ($Depth + 1) -MaxDepth $MaxDepth
280+
$val1 = $Object1.$propName
281+
$val2 = $Object2.$propName
282+
$val1IsEmpty = ($null -eq $val1 -or $val1 -eq '' -or ($val1 -is [Array] -and $val1.Count -eq 0))
283+
$val2IsEmpty = ($null -eq $val2 -or $val2 -eq '' -or ($val2 -is [Array] -and $val2.Count -eq 0))
284+
if ($val1IsEmpty -and $val2IsEmpty) {
285+
# Both empty (null, "", []) - no difference
286+
continue
287+
}
288+
if ($val1 -or $val2) {
289+
Compare-ObjectsRecursively -Object1 $val1 -Object2 $val2 -PropertyPath $newPath -Depth ($Depth + 1) -MaxDepth $MaxDepth
282290
}
283291
} catch {
284292
throw
285293
}
286294
} elseif ($prop1Exists) {
287295
try {
288-
$result.Add([PSCustomObject]@{
296+
$val = $Object1.$propName
297+
$valIsEmpty = ($null -eq $val -or $val -eq '' -or ($val -is [Array] -and $val.Count -eq 0))
298+
if (-not $valIsEmpty) {
299+
$result.Add([PSCustomObject]@{
289300
Property = $newPath
290-
ExpectedValue = $Object1.$propName
301+
ExpectedValue = $val
291302
ReceivedValue = ''
292303
})
304+
}
293305
} catch {
294306
throw
295307
}
296308
} else {
297309
try {
298-
$result.Add([PSCustomObject]@{
310+
$val = $Object2.$propName
311+
$valIsEmpty = ($null -eq $val -or $val -eq '' -or ($val -is [Array] -and $val.Count -eq 0))
312+
if (-not $valIsEmpty) {
313+
$result.Add([PSCustomObject]@{
299314
Property = $newPath
300315
ExpectedValue = ''
301-
ReceivedValue = $Object2.$propName
316+
ReceivedValue = $val
302317
})
318+
}
303319
} catch {
304320
throw
305321
}

Modules/CippEntrypoints/CippEntrypoints.psm1

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -255,10 +255,14 @@ function Receive-CippOrchestrationTrigger {
255255
Write-Information "Durable Mode: $DurableMode"
256256

257257
$RetryOptions = New-DurableRetryOptions @DurableRetryOptions
258-
if (!$OrchestratorInput.Batch -or ($OrchestratorInput.Batch | Measure-Object).Count -eq 0 -and $OrchestratorInput.QueueFunction) {
259-
$Batch = (Invoke-ActivityFunction -FunctionName 'CIPPActivityFunction' -Input $OrchestratorInput.QueueFunction -ErrorAction Stop) | Where-Object { $null -ne $_.FunctionName }
260-
} elseif ($OrchestratorInput.Batch) {
258+
259+
$HasBatch = $OrchestratorInput.Batch -and @($OrchestratorInput.Batch).Count -gt 0
260+
$HasQueueFunction = $null -ne $OrchestratorInput.QueueFunction -and $OrchestratorInput.QueueFunction -ne ''
261+
262+
if ($HasBatch) {
261263
$Batch = $OrchestratorInput.Batch | Where-Object { $null -ne $_.FunctionName }
264+
} elseif ($HasQueueFunction) {
265+
$Batch = (Invoke-ActivityFunction -FunctionName 'CIPPActivityFunction' -Input $OrchestratorInput.QueueFunction -ErrorAction Stop) | Where-Object { $null -ne $_.FunctionName }
262266
} else {
263267
Write-Information 'No batch or queue function provided to orchestrator input'
264268
$Batch = @()

0 commit comments

Comments
 (0)