Skip to content

Commit 409a8ed

Browse files
better compares,. final bug fix
1 parent 312b254 commit 409a8ed

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

Modules/CIPPCore/Public/Compare-CIPPIntuneObject.ps1

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,8 +285,15 @@ function Compare-CIPPIntuneObject {
285285
# Both empty (null, "", []) - no difference
286286
continue
287287
}
288-
if ($val1 -or $val2) {
288+
if ($null -ne $val1 -and $null -ne $val2) {
289289
Compare-ObjectsRecursively -Object1 $val1 -Object2 $val2 -PropertyPath $newPath -Depth ($Depth + 1) -MaxDepth $MaxDepth
290+
} elseif (-not $val1IsEmpty -or -not $val2IsEmpty) {
291+
# One side is null/empty, the other is not - report as difference
292+
$result.Add([PSCustomObject]@{
293+
Property = $newPath
294+
ExpectedValue = if ($null -eq $val1) { '' } else { $val1 }
295+
ReceivedValue = if ($null -eq $val2) { '' } else { $val2 }
296+
})
290297
}
291298
} catch {
292299
throw

0 commit comments

Comments
 (0)