Fix silent bulk compare crash: op_Addition on PSObject

In Start-BulkCompareExportObjects the flat CSV row was built with
'$compValue +=' where $compValue is a single PSCustomObject element of
the result array. PowerShell has no op_Addition for PSObject, so every
silent batch compare using the 'Exported Files with Intune Objects (Id)'
provider threw 'Method invocation failed because [PSObject] does not
contain a method named op_Addition' before Save-BulkCompareResults ran,
and no CSV was produced.

All other compare providers assign the row object directly; this aligns
the export provider with them. Verified against a live tenant: the
silent BulkCompare job now completes and writes the result CSV.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
McKenzieCo
2026-07-21 18:02:23 -04:00
co-authored by Claude Fable 5
parent 5bb84c8561
commit 51e5966fa7
+1 -1
View File
@@ -706,7 +706,7 @@ function Start-BulkCompareExportObjects
$objName = Get-GraphObjectName (?? $compObj.Object1 $compObj.Object2) $item.ObjectType $objName = Get-GraphObjectName (?? $compObj.Object1 $compObj.Object2) $item.ObjectType
foreach($compValue in $compObj.Result) foreach($compValue in $compObj.Result)
{ {
$compValue += [PSCustomObject]@{ $compValue = [PSCustomObject]@{
ObjectName = $objName ObjectName = $objName
Id = $compObj.Id Id = $compObj.Id
Type = $compObj.ObjectType.Title Type = $compObj.ObjectType.Title