Author Posts

March 19, 2018 at 6:50 am

my info.psd1 file contains:
@{

AllNodes = @(

@{
NodeName = "*"
},
@{
NodeName = "DSC-Client"
Role = "web"
},
@{
NodeName = "DSC-SQL2014"
Role = "sql"
}
)
}

my node configuration is:

Configuration MyWebApp
{
Import-DscResource -Module PSDesiredStateConfiguration

Node $AllNodes.Where{$_.Role -Contains "web"}.NodeName
{
File CreateFile {
Ensure = "Present"
DestinationPath = "C:\Users\devopsuser1\Documents\Test.txt"
Contents = "Hello DSC"
}
}

Node $AllNodes.Where{$_.Role -Contains "sql"}.NodeName
{
File CreateFile {
Ensure = "Present"
DestinationPath = "C:\Users\devopsuser1\Documents\Test.txt"
Contents = "Hello DSC"
}
}
}
MyWebApp -ConfigurationData "C:\Users\devopsuser1\Desktop\info.psd1"

when i run this this configuration iam getting two mof files with "DSC-Client.mof" and "DSC-SQL2014.mof".
Now i have to run LCM for that can i generate guid and checksum for each mof file and placed in the path "C:\Program Files\WindowsPowerShell\DscService\Configuration" and update my LCM with latest GUIDS for 2 mof files is necessary.
How my LCM to be drafed for multiple nodes

Plz suggest on this issue.

Thanks
sivaji

March 19, 2018 at 11:41 am

I'm not sure I understand the question but if you take a look at the docs page it walks you through how to apply a configuration.

https://docs.microsoft.com/en-us/powershell/dsc/configurations

You can author configurations like this where one script generates multiple configurations but there isn't much benefit for the complexity it adds. One script per configuration makes for a nice clean CI test environment.