techthoughts2
6/10/2018 - 6:48 PM

DSC using localhost

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