Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Basic DSC example of simple configuration using localhost. The compiled MOF could be pulled to a variety of different servers or renamed and pushed to a variety of different servers
Configuration Demo3 {
Param ()
Import-DscResource -ModuleName PSDesiredStateConfiguration
node localhost {
#------------------------------------
WindowsFeature 'Telnet-Client' {
#DependsOn = "[WindowsFeature]Failover-Clustering"
Ensure = "Absent"
Name = "Telnet-Client"
} #telnet
#------------------------------------
File RequiredDirectory {
Ensure = 'Present'
Type = 'Directory'
DestinationPath = "C:\RequiredDirectory"
} #requiredDirectory
#------------------------------------
File NewBossRequest {
Ensure = 'Present'
Type = 'Directory'
DestinationPath = "C:\NewDirectory"
} #newBossDirectory
#------------------------------------
} #localhost
} #close configuration
Demo3 -OutputPath C:\DSC\Test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment