PowerShell Desired State Configuration (DSC) Journey – Day 5

Bonus Reading Today!  The Microsoft Scripting Guy is unleashing a series of articles this week about DSC that I highly recommend.  First is the Intro to PowerShell 4.0 Desired State Configuration, followed by Using PowerShell 4.0 DSC Parameters and a PowerTip for Finding PowerShell 4.0 DSC Cmdlets.

So far I have spent most of my time getting started with the DSC Resources and playing around with the File Resource specifically.  Today I am going to configure a DSC Pull Server following the instructions in Don Jones DSC E-Book which you can find here.

The first step is download the xPSDesiredStateConfiguration module from here.  You need to extract the contents of the .ZIP file to \Program Files\WindowsPowerShell\Modules.  In this specific case, when you extract the files it will try to extract it with _1.1 on the end of it.  Make sure to remove that from the folder name or the module will not load into PowerShell properly.  You will need to do this on both the computer you are writing the Configuration on (in my case Windows 8.1) and also the server you are going to be configuring as the DSC Pull Server.  You should also make sure the execution policy on your Windows 8.1 computer is set to RemoteSigned.

I kept the ConfigurationScript in the e-book (which was pulled from the Microsoft TechNet site for the xPSDesiredStateConfiguration Resource) exactly the same.  Here it is.

I then Invoke the Configuration to create the MOF file for MyTargetServer.  After that run the command below to push the Configuration to MyTargetServer.

It fails miserably.

The error messages seem pretty clear, DSC could not load the module that contains the MSFT_xDSCWebService.  So let’s take a look at MyTargetServer.  Looks to me like everything is as it should be.  I load the xPSDesiredStateConfiguration module with no problems.  The xDSCWebService Resource shows up when Get-DSCResource and the files in the Modules folder match exactly what is on my Windows 8.1 Desktop.


Well.  That is certainly puzzling.  What happens if I run the configuration directly from MyTargetServer?  Let’s find out!  I redo all those steps above except for where I Invoke and start the Configuration, and the exact same thing happens.  The module path is in the $env:PSModulePath.  I am kind of stumped.  I have no idea what I did wrong here.  The DSC logs on MyTargetServer aren’t of any use either. Since nothing else is sticking out right now as an idea, I reboot the server.  Because that always works.  Right?

Round 2.  Post Reboot.  Go!

AND IT FREAKING WORKED.  OF COURSE IT DID.  You won’t be able to tell from this short article, but I didn’t reach the “hell let’s reboot the server” stage until many hours of troubleshooting and reinstalling the module had passed.

Here’s the Verbose output when it finishes installing properly.

Things I Learned Today:

  • How to setup a DSC Pull Server
  • When in doubt, reboot

That’s it for today.  Tomorrow I am going to explore the Windows Feature Resource.  I am also going to build another DSC Test server today so we can use that for testing pulling Configurations from our new DSC Pull Server.