PowerShell Desired State Configuration (DSC) Journey – Day 14

On Monday I ran into some issues with the Environment Resource (I am not done with that either, I just need some time to setup my home lab).  Today I am going to mess around with the Archive Resource.  And in a weird, ongoing issue, the Consistency scheduled task is still running.  So let’s reboot the server like usual before we start.

Archive Resource information can be found here.  The Properties of the Resource are shown below.

I have a .zip file of PowerShell scripts that I want to unzip and ensure always exist in the C:\Scripts directory.  Here is the code that I added to my Configuration script.  I chose to include the Checksum Property because that pretty much ensures that I will break something.

And I was right!  Here is the relevant information in the Trace-cDSCOperation output.

Fair enough.  The TechNet article lists a Validate Property but it has no description, and their example doesn’t use it.  This should be fun.  If I type the word Validate in ISE, highlight it, and do Ctrl + Right Click + Start Intellisense it tells me that it is looking for a bool value.  New code is below.

Great Success!  Here is the contents of my Scripts folder.


My Checksum is based on the modifiedDate, so let’s modify the .Zip file by removing some scripts and see what happens.  I removed the first 5-7 scripts from the .Zip file and forced DSCTest to Pull it’s Configuration again.  There shouldn’t be any changes because the files that are currently in the .Zip file already exist.  And…..I was correct!  There were no changes to the contents of the C:\Scripts folder.

One last test before I head to a meeting.  Let’s set Ensure = “Absent” and let’s see what happens.  What should happen is that every script that currently resides in the .Zip file should be removed.  Boom!


Good day today!  Looking at the Built-In DSC Resource List, I think tomorrow I will explore the DSC Role Resource.