<#
[Video] A Practical Overview of Desired State Configuration
http://channel9.msdn.com/events/TechEd/NorthAmerica/2014/DCIM-B417
[eBook] PowerShell.org DSC Hub
http://powershell.org/wp/dsc-hub/
[TechNet] Windows PowerShell Desired State Configuration Overview
http://technet.microsoft.com/en-us/library/dn249912.aspx
[Gallery] DSC Resources
https://www.powershellgallery.com/
[GitHub] DSC Resource source code
https://github.com/PowerShell/DscResources
#>
###
### Define the configuration
###
configuration Foo
{
# One can evaluate expressions to get the node list
# E.g: $AllNodes.Where("Role -eq Web").NodeName
node (hostname)
{
# Call Resource Provider
# E.g: WindowsFeature, File
WindowsFeature XPSViewer
{
Ensure = "Present"
Name = "XPS-Viewer"
}
}
}
###
### Generate the MOF file from the Configuration
###
foo -OutputPath C:\DSC\Foo
###
### View the generated MOF
###
psedit "C:\DSC\Foo\$(hostname).mof"
###
### Process the configuration in the LCM (make it so!)
###
Start-DscConfiguration -Wait -Verbose -Path C:\DSC\Foo -Force
###
### Check the result, did it install?
###
Get-WindowsFeature -name XPS-Viewer | Remove-WindowsFeature
###
### Check on the status of the configuration
###
Get-DscConfigurationStatus
###
### Get the actual configuration
###
Get-DscConfiguration
###
### Get the local configuration manager (LCM) configuration
###
Get-DscLocalConfigurationManager
###
### Get the DSC resources on the computer
###
Get-DscResource
###
### Find the DSC resources in the gallery
###
Find-DscResource
###
### Next Demo...
###
### https://gist.github.com/mgreenegit/c366f14ed82c6139aa3c