microsoft / BaselineManagement

Conversion tool used to Convert Group Policy baselines into DSC
MIT License
266 stars 52 forks source link

Write-DSCString produces empty If statements when a condition is passed #9

Closed armentpau closed 4 years ago

armentpau commented 7 years ago

If a condition if passed to Write-DSCString two empty if() statements are passed to the configuration script for each block.

You get a structure as follows: if() {

} if() { } It looks like the order of code used in Write-DSCString when a condition is passed is partially to blame as well as the code for the condition variable. THe one I encountered came from Internetsettings.ps1 $Condition = [scriptblock]"`$InternetExplorerVersion -eq $($XML.ParentNode.ParentNode.Name)" If you run this you get a message that PS cannot convert a string to a script block. I managed to get around this by doing $Condition = $executionContext.invokeCommand.NewScriptBlock("`$InternetExplorerVersion -eq `"$($XML.ParentNode.ParentNode.Name)`"")
mgreenegit commented 4 years ago

Closing stale issue since ASC format did not continue to v3.