Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
This DSC example contains two server nodes and will compile to two individual MOFs. One for Server1, and one for Server2. In this example the code configuration is duplicated for each node. This is not very efficient and this serves only as an examp
Configuration Demo1 {
Param ()
Import-DscResource -ModuleName PSDesiredStateConfiguration
node Server1 {
#------------------------------------
WindowsFeature 'Telnet-Client' {
#DependsOn = "[WindowsFeature]Failover-Clustering"
Ensure = "Absent"
Name = "Telnet-Client"
} #telnet
#------------------------------------
File RequiredDirectory {
Ensure = 'Present'
Type = 'Directory'
DestinationPath = "C:\RequiredDirectory"
} #requiredDirectory
#------------------------------------
} #server1
node Server2{
#------------------------------------
WindowsFeature 'Telnet-Client' {
#DependsOn = "[WindowsFeature]Failover-Clustering"
Ensure = "Absent"
Name = "Telnet-Client"
} #telnet
#------------------------------------
File RequiredDirectory {
Ensure = 'Present'
Type = 'Directory'
DestinationPath = "C:\RequiredDirectory"
} #requiredDirectory
#------------------------------------
} #server2
} #close configuration
Demo1 -OutputPath C:\DSC\Test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment