Skip to content

Instantly share code, notes, and snippets.

@JasonMorgan
Created May 9, 2014 19:39
Show Gist options
  • Save JasonMorgan/ce26cda8b2ac56ea2d5d to your computer and use it in GitHub Desktop.
Save JasonMorgan/ce26cda8b2ac56ea2d5d to your computer and use it in GitHub Desktop.
Use a DSC Configuration
This gist simply covers using a DSC configuration to configure an endpoint.
Load the DSC resource like any other function.
1. You can copy and paste the Configuration into a powershell console
2. You can dot source the script containing the configuration
EX: . c:\scripts\DSCConfiguration.ps1
Note - there are other ways as well but I have limited time...
Call the configuration by it's name and supply any parameters you need
Ex: CustomConfig -computername Host1 -outputpath c:\temp
This calls the configuration, CustomConfig, Sets the Target computer to Host1, and writes the MOF to the C:\temp directory
You need this MOF in order to provide it to the Local Configuration Manager agent on the target computer.
You'll need to have WSMAN working between the various computers you'll be configuring to and from.
Important to note, if you, for some crazy reason, don't want to enable PSRemoting you can still use DSC. It does not require PSRemoting.
Use the Start-DscConfiguration to configure your target
Ex: Start-DscConfiguration -ComputerName Host1 -Path c:\temp
If you want to see all the cool verbose output you'll need to add -wait and -verbose to that.
And that's it. You should now be able to use DSC to configure a server using the DSC push method.
If you need a simple configuration to try out then check out this pastebin link:
http://pastebin.com/YRPcaqX3
Thanks for reading, ping me @rjasonmorgan if you want anything else on this topic.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment