Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

M365DSCUtil: Problem naming similar resources #3700

Closed
ricmestre opened this issue Sep 20, 2023 · 0 comments · Fixed by #3701 or #3702
Closed

M365DSCUtil: Problem naming similar resources #3700

ricmestre opened this issue Sep 20, 2023 · 0 comments · Fixed by #3701 or #3702

Comments

@ricmestre
Copy link
Contributor

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

Please read description

Environment Information + PowerShell Version

OsName               : Microsoft Windows 10 Enterprise
OsOperatingSystemSKU : EnterpriseEdition
OsArchitecture       : 64-bit
WindowsVersion       : 2009
WindowsBuildLabEx    : 19041.1.amd64fre.vb_release.191206-1406
OsLanguage           : en-US
OsMuiLanguages       : {en-US}

Name                           Value
----                           -----
PSVersion                      5.1.19041.3031
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.19041.3031
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant