diff --git a/CHANGELOG.md b/CHANGELOG.md index f0874b1b99..fe25e7b955 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,8 @@ * MISC * Improved error logging for methods installing or updating modules. FIXES [#3660](https://github.com/microsoft/Microsoft365DSC/issues/3660) + * Single quotes handling in Export for complex CIMInstances + FIXES [#3479](https://github.com/microsoft/Microsoft365DSC/issues/3479) # 1.23.906.1 diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationAdministrativeTemplatePolicyWindows10/MSFT_IntuneDeviceConfigurationAdministrativeTemplatePolicyWindows10.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationAdministrativeTemplatePolicyWindows10/MSFT_IntuneDeviceConfigurationAdministrativeTemplatePolicyWindows10.psm1 index d9522e8679..630f72093d 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationAdministrativeTemplatePolicyWindows10/MSFT_IntuneDeviceConfigurationAdministrativeTemplatePolicyWindows10.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationAdministrativeTemplatePolicyWindows10/MSFT_IntuneDeviceConfigurationAdministrativeTemplatePolicyWindows10.psm1 @@ -913,6 +913,7 @@ function Export-TargetResource $currentDSCBlock = $currentDSCBlock.replace( " ,`r`n" , " `r`n" ) $currentDSCBlock = $currentDSCBlock.replace( "`r`n;`r`n" , "`r`n" ) $currentDSCBlock = $currentDSCBlock.replace( "`r`n,`r`n" , "`r`n" ) + $currentDSCBlock = $currentDSCBlock.Replace("} Enabled = `$","}`r`n Enabled = `$") $dscContent += $currentDSCBlock Save-M365DSCPartialExport -Content $currentDSCBlock ` diff --git a/Modules/Microsoft365DSC/Modules/M365DSCDRGUtil.psm1 b/Modules/Microsoft365DSC/Modules/M365DSCDRGUtil.psm1 index 14108b6e2c..8ab212b278 100644 --- a/Modules/Microsoft365DSC/Modules/M365DSCDRGUtil.psm1 +++ b/Modules/Microsoft365DSC/Modules/M365DSCDRGUtil.psm1 @@ -397,7 +397,12 @@ function Get-M365DSCDRGComplexTypeToString } else { - $currentProperty += Get-M365DSCDRGSimpleObjectTypeToString -Key $key -Value $ComplexObject[$key] -Space ($indent) + $currentValue = $ComplexObject[$key] + if ($currentValue.GetType().Name -eq 'String') + { + $currentValue = $ComplexObject[$key].Replace("'", "''").Replace("�", "''") + } + $currentProperty += Get-M365DSCDRGSimpleObjectTypeToString -Key $key -Value $currentValue -Space ($indent) } } else