diff --git a/src/PolicyIO.ps1 b/src/PolicyIO.ps1 index 6b9df4b..ca77500 100644 --- a/src/PolicyIO.ps1 +++ b/src/PolicyIO.ps1 @@ -586,14 +586,18 @@ function Import-GraphAdministrativeTemplate { try { $tgtPres = @(Get-GraphPaged -Uri "$defRoot/$defId/presentations" -AsRawJson) } catch { $tgtPres = @() } } - $presVals = @() + $presVals = @() $typeCounter = @{} + $presFailed = $false foreach ($pv in @(Get-PolicyProp $dv 'presentationValues')) { if (-not $pv) { continue } $pres = Get-PolicyProp $pv 'presentation' if ($ingested) { $presId = Resolve-TargetPresentationId -TargetPres $tgtPres -SrcPresentation $pres -Counter $typeCounter - if (-not $presId) { $errors += "${defName}: Presentation im Ziel nicht zuordenbar - Wert uebersprungen"; continue } + # Presentation nicht zuordenbar (andere ADMX-Version im Ziel): die GANZE + # Einstellung ueberspringen, statt mit unvollstaendigem Body ein 400 zu + # provozieren. + if (-not $presId) { $presFailed = $true; break } } else { $presId = [string](Get-PolicyProp $pres 'id') } @@ -608,6 +612,10 @@ function Import-GraphAdministrativeTemplate { } $presVals += $entry } + if ($presFailed) { + $errors += "${defName}: Eingabefelder passen nicht zur Ziel-ADMX (andere Version?) - uebersprungen" + continue + } $body = [ordered]@{ enabled = [bool](Get-PolicyProp $dv 'enabled')