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" }