How do I provide configuration name dynamically during DSC compilation?

38 Views Asked by At

I have configuration named sqlconfig defined in file called sqlconfig.ps1 which I want to compile while passing DSC data structure and name of configuration itself to it. Sample code is below

$sqlData =
@{
   AllNodes    =
   @(
      @{
         NodeName                    = "*"
         PSDscAllowPlainTextPassword = $true
      }
    );
}
. $PSScriptRoot/sqlconfig.ps1
$configName = 'sqlconfig'
Invoke-Command -ScriptBlock { $name } -ArgumentList  "-ConfigurationData $sqlData"

Code above does not work and do not compile configuration to MOF file. Neither Invoke-Command -ScriptBlock { "$name -ConfigurationData $sqlData" }

0

There are 0 best solutions below