Open ephos opened 5 years ago
I'll take a look at the here string logic for this.
Sorry for the hiatus
@bobbytreed is this still an issue?
I'm using version 3.1.1 of the module, and it is still an issue. Is there any movement on it?
Exception calling "Create" with "1" argument(s): "At line:1288 char:26
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : ParseException
Complete-Configuration : Could not CREATE ScriptBlock from configuration. Creating PS1 Error File: D:\GPO-to-DSC\GPO\DSCOutput{D8DAE6FA-3201-4E6D-8271-9A0BF446BEDA}\DSCFromGPO.ps1.error. Please rename error file to PS1 and open for further inspection. Errors are listed below At C:\Program Files\WindowsPowerShell\Modules\BaselineManagement\2.9.0\BaselineManagement.psm1:719 char:17
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Complete-Configuration
I can try to help with this one. To help with repro - this occurs when the message contains single quotes? Or am I misunderstanding?
We are enforcing legal banners on servers so we set the following keys (I changed the actual values to protect the innocent).
These are the values contained in the GPO backup (.{7C78F02A-DBCF-460D-8C0F-A7B5E8082F5B}\DomainSysvol\GPO\Machine\microsoft\windows nt\SecEdit\GptTmpl.inf)
MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System\LegalNoticeText=1,"'Legal mumbo jumbo.'"
MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System\LegalNoticeCaption=1,"'DONT HACK THIS STUFF BRO!'"
When I run
ConvertFrom-GPO
it throws an exception when it gets to these settings, due to the way they are double quoted and single quoted ("'message'"
).This is the exception.
I get two of these exceptions, when running through the debugger I can confirm it's on these two items.
If I modify the lines in the GptTmpl.inf and replace the quotes with just single quotes, everything works prefect. In the short term i'll look into getting our legal banner to not have the extra quotes, I'm sure that'll be fine, I wanted to report the issue in case other ran into it.