Skip to content

Instantly share code, notes, and snippets.

@techthoughts2
Last active June 10, 2018 18:57
Show Gist options
  • Save techthoughts2/e72ef7f0a9b9797d44e0a77f48940883 to your computer and use it in GitHub Desktop.
Save techthoughts2/e72ef7f0a9b9797d44e0a77f48940883 to your computer and use it in GitHub Desktop.
This DSC example contains multiple nodes and compile to multiple MOFs, one for each server. In this example the code configuration is not duplicated, and is instead replicated out for each node during the compile of the MOFs. This is often more effic
Configuration Demo2 {
Param ()
Import-DscResource -ModuleName PSDesiredStateConfiguration
node $AllNodes.NodeName {
#------------------------------------
WindowsFeature 'Telnet-Client' {
#DependsOn = "[WindowsFeature]Failover-Clustering"
Ensure = "Absent"
Name = "Telnet-Client"
} #telnet
#------------------------------------
File RequiredDirectory {
Ensure = 'Present'
Type = 'Directory'
DestinationPath = "C:\RequiredDirectory"
} #requiredDirectory
#------------------------------------
} #allNodes
} #close configuration
$cd = @{
AllNodes = @(
@{ NodeName = 'Server1'},
@{ NodeName = 'Server2'},
@{ NodeName = 'Server3'}
)
}
Demo2 -Configuration $cd -outputpath c:\DSC\Test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment