diff --git a/CHANGELOG.md b/CHANGELOG.md index c0297ccb86..c8a555a696 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Change log for Microsoft365DSC +# UNRELEASED + +* MISC + * M365DSCDRGUtil: Write properties properly indented and in new line + FIXES [#3634](https://github.com/microsoft/Microsoft365DSC/issues/3634) + # 1.23.920.1 * O365OrgSettings diff --git a/Modules/Microsoft365DSC/Modules/M365DSCDRGUtil.psm1 b/Modules/Microsoft365DSC/Modules/M365DSCDRGUtil.psm1 index 8ab212b278..65bd393b92 100644 --- a/Modules/Microsoft365DSC/Modules/M365DSCDRGUtil.psm1 +++ b/Modules/Microsoft365DSC/Modules/M365DSCDRGUtil.psm1 @@ -400,7 +400,7 @@ function Get-M365DSCDRGComplexTypeToString $currentValue = $ComplexObject[$key] if ($currentValue.GetType().Name -eq 'String') { - $currentValue = $ComplexObject[$key].Replace("'", "''").Replace("�", "''") + $currentValue = $ComplexObject[$key].Replace("'", "''").Replace("�", "''") } $currentProperty += Get-M365DSCDRGSimpleObjectTypeToString -Key $key -Value $currentValue -Space ($indent) } @@ -430,17 +430,17 @@ function Get-M365DSCDRGComplexTypeToString } $currentProperty += "$indent}" - #if ($isArray -or $IndentLevel -gt 4) - #{ - #$currentProperty += "`r`n" - #} + if ($isArray -or $IndentLevel -gt 4) + { + $currentProperty += "`r`n" + } - #Indenting last parenthese when the cim instance is an array - <#if ($IndentLevel -eq 5) + #Indenting last parenthesis when the cim instance is an array + if ($IndentLevel -eq 5) { $indent = ' ' * ($IndentLevel -2) $currentProperty += $indent - }#> + } $emptyCIM = $currentProperty.replace(' ', '').replace("`r`n", '') if ($emptyCIM -eq "MSFT_$CIMInstanceName{}")