-
Notifications
You must be signed in to change notification settings - Fork 532
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
New-M365DSCReportFromConfiguration: en dash in EXOGroupSettings DisplayName causes DSCParser exception #5202
Comments
That sounds very strange, but somehow I expected something like that. The culprit here might be the fact that en dash is a Unicode character and not all Unicode characters might be available… I‘ll take a look at it if I have time. |
@FabienTschanz This is a known issue, check out #4824 |
Uhmm, "it works on my machine" 😓 Will dig a bit deeper. |
@nick-waterhouse Quick question: Are there multiple versions of Microsoft365DSC installed? |
@FabienTschanz Just the one version for me. Output is as follows:
|
Is the issue still present? I'm unable to reproduce it. |
It appears to be. I get the following when running against the current version of M365DSC:
|
Alright. Can you share the bit of your configuration that's failing? This seems very much like #5848 that I opened today because those double quotes are not the "standard" ones. If I have the configuration, I'll be able to check against my environment with an export and if the PR does what it's supposed to and escape those "fancy" double quotes as we're calling them. |
I believe the configuration is the sample one I included in this ticket. The problematic bit is the line: |
Now I see. So the en-dash is silently converted into that "ugly-looking" Edit: Yeah, using Windows PowerShell and UTF-8 encoding it fails for me as well. The solution is to save it as UTF-16, or a specific import of the file using |
The error message looks a lot more comprehensive than what was there before, but yes, it does seem like the en-dash is being converted into Notepad++ claims the PSD I am using is UTF-8 encoded, and I can confirm I am running in a PS5.1 admin session. Edit: Looking at your edit, it might be a fairly easy workaround to convert the files to UTF-16 before creating reports or comparing configs. Given that the configs are straight exports from M365DSC, would it be possible for Edit 2: To be exact, Notepad++ is claiming UTF-8 but with no BOM. Is it possible that |
The issue isn't directly related to the file "only" being UTF-8, rather it's because Windows PowerShell uses a different code page (namely Windows-1252, a subset of UTF-8). This means that characters outside of the ASCII range won't be properly handled by Windows PowerShell unless we can somehow configure the default behavior of the terminal. I believe this would be PowerShell 7 isn't affected by that because it doesn't use Windows-1252 anymore but rather UTF-8. So no problems there. Checking how we can change the behavior of that so that the default isn't Windows-1252 but rather UTF-8. |
@nick-waterhouse Can you do me a favor please? Save the file again as UTF-8, just as it was before. Then, set the following registry item: Key: After that, restart your PowerShell 5.1 session and try to compile the configuration or even generate a report. It should work now. Alternatively if modifying the registry isn't an option, you can set the following setting in the international language settings |
@FabienTschanz Changing that setting did the trick - report was created as expected! I'll keep an eye out as I continue using M365DSC and update if similar errors popup, but I suspect this intervention has cleaned up a whole class of problems. |
@nick-waterhouse Thank you very much for the confirmation. I'll shortly open a PR that adds a warning message if this setting is not configured. |
Description of the issue
While attempting to create a report for a configuration, I received similar exceptions to those in the verbose logs.
I was able to reduce the configuration down to the one in the DSC configuration section, where the configuration reliably caused an exception.
My script is as follows:
Strangely, the culprit is having the
DisplayName
contain an en dash, such as"Group – name"
- I expect other characters, such as em dash, would behave similarly. If I replace this character with a regular minus character, or remove it completely, the report is successfully created.I can confirm that my dependencies are up to date, and that I am running this in an elevated terminal.
Is there anything that can be done here?
Microsoft 365 DSC Version
V1.24.1016.1
Which workloads are affected
Exchange Online
The DSC configuration
Verbose logs showing the problem
Environment Information + PowerShell Version
OsName : Microsoft Windows 11 Enterprise
OsOperatingSystemSKU : EnterpriseEdition
OsArchitecture : 64-bit
WindowsVersion : 2009
WindowsBuildLabEx : 22000.1.amd64fre.co_release.210604-1628
OsLanguage : en-GB
OsMuiLanguages : {en-GB, en-US}
The text was updated successfully, but these errors were encountered: