You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Cmdlet Get-M365DSCExportContentForResource, from M365DSCUtil.psm1, takes care of giving a ResourceInstanceName to the exported resource, this works out well if all resources have unique names but if they are similar then a "-2" will be appended to the name.
E.g.: I have 4 policies with similar names, as per below, and since Windows 10/11 - Update - Global is processed last then the instance name will be Windows 10/11 - Update - Global-2, this happens because $Global:M365DSCExportedResourceInstancesNames on L3304 is not being declared as a string array and therefore ends up as a regular string with all exported resources which if Contains method is run against will return as true.
Windows 10/11 - Update - Global Wave 1
Windows 10/11 - Update - Global Wave 2
Windows 10/11 - Update - Global Wave 3
Windows 10/11 - Update - Global
The simplest solution for this problem is to just cast $Global:M365DSCExportedResourceInstancesNames as a string array, in fact in Export-M365DSCConfiguration this var is being declared as an array so this matches my observation.
Description of the issue
Cmdlet Get-M365DSCExportContentForResource, from M365DSCUtil.psm1, takes care of giving a ResourceInstanceName to the exported resource, this works out well if all resources have unique names but if they are similar then a "-2" will be appended to the name.
E.g.: I have 4 policies with similar names, as per below, and since Windows 10/11 - Update - Global is processed last then the instance name will be Windows 10/11 - Update - Global-2, this happens because $Global:M365DSCExportedResourceInstancesNames on L3304 is not being declared as a string array and therefore ends up as a regular string with all exported resources which if Contains method is run against will return as true.
Windows 10/11 - Update - Global Wave 1
Windows 10/11 - Update - Global Wave 2
Windows 10/11 - Update - Global Wave 3
Windows 10/11 - Update - Global
The simplest solution for this problem is to just cast $Global:M365DSCExportedResourceInstancesNames as a string array, in fact in Export-M365DSCConfiguration this var is being declared as an array so this matches my observation.
Microsoft 365 DSC Version
DEV
Which workloads are affected
other
The DSC configuration
N/A
Verbose logs showing the problem
Environment Information + PowerShell Version
The text was updated successfully, but these errors were encountered: