Last active
December 13, 2016 20:19
-
-
Save bobalob/5ae99e131ebfe8822e0047ac75750f6c to your computer and use it in GitHub Desktop.
Example configuration to store on the pullserver for the LCM configured with ConfigurationID
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
configuration ServerBuild | |
{ | |
Import-DscResource -ModuleName 'PSDesiredStateConfiguration' | |
Node $AllNodes.NodeName | |
{ | |
File ServerBuild | |
{ | |
DestinationPath = "C:\ServerBuild-1.txt" | |
Type = "File" | |
Contents = "Testing" | |
Ensure = 'Present' | |
} | |
} | |
} | |
configuration AppConfig | |
{ | |
Import-DscResource -ModuleName 'PSDesiredStateConfiguration' | |
Node $AllNodes.NodeName | |
{ | |
File AppConfig | |
{ | |
DestinationPath = "C:\AppConfig-2.txt" | |
Type = "File" | |
Contents = "Testing" | |
Ensure = 'Present' | |
} | |
} | |
} | |
$MyNodes = | |
@{ | |
AllNodes = | |
@( | |
@{ | |
NodeName = "pullclient.example.com" | |
ConfigurationID = "***use New-Guid to generate***" | |
} | |
); | |
} | |
ServerBuild -OutPutPath C:\DSC\TestConfig\srv -ConfigurationData $MyNodes | |
AppConfig -OutPutPath C:\DSC\TestConfig\app -ConfigurationData $MyNodes | |
Foreach ($Node in $MyNodes.AllNodes) { | |
$source = "C:\DSC\TestConfig\srv\$($Node.NodeName).mof" | |
$dest = "C:\Program Files\WindowsPowerShell\DscService\Configuration\ServerBuild.$($Node.ConfigurationID).mof" | |
Copy-Item -Path $source -Destination $dest -Force | |
New-DSCChecksum $dest -Force | |
$source = "C:\DSC\TestConfig\app\$($Node.NodeName).mof" | |
$dest = "C:\Program Files\WindowsPowerShell\DscService\Configuration\AppConfig.$($Node.ConfigurationID).mof" | |
Copy-Item -Path $source -Destination $dest -Force | |
New-DSCChecksum $dest -Force | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment