Last active
May 15, 2022 07:45
-
-
Save craig-martin/3fdb07be1618de57ec1b7a6f15001fb3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
[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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment