cVSS Custom Desired State Configuration (DSC) Resource

I will keep this pretty short and sweet. I was asked to create a Custom DSC Resource that could ensure that Volume Shadow Copies was always enabled on a drive. I thought it would be pretty easy to do, but turns out it wasn’t nearly as easy as I thought. When you enable VSS through the GUI there are two things that happen. First, VSS gets enabled on the drive with some default settings. Second, two scheduled tasks are created that match those settings to actually create the shadow copies. Because of that I broke this custom resource into two parts. The cVSS Resource just specifies the drive you want to enable, whether or not you want to enable it, what drive you want to store the shadow copies on, and how much space you want the shadow copies to take up. A Configuration using this Resource looks like this:

The cVSSTaskScheduler Resource creates the Scheduled Tasks that create the actual shadow copies on the drive. A Configuration using this Resource looks like this:

All the files you need to use this Resource can be found on my GitHub site. There is an Examples folder that has the two examples above plus a Configuration using both. The Files folder contains two files that just show how I created (and Updated) the Resource as I went through the process of actually getting it to work. I am very new to the whole GitHub thing so if there are bugs, things that I missed, or a better way of doing something and you want to update or change the files let me know and we can certainly do that.

2 thoughts on “cVSS Custom Desired State Configuration (DSC) Resource

  1. Hi ,

    I have just tested your Resource .

    Just wanted to mentioned that Test-TargetResource on cVSSTaskScheduler always returned False .

    If($Actions.Contains($Drive) -and $TaskTime.Contains($NewTime)) there is issue here .

    $TaskTime returns time in different format then specified in $TriggerTime .

    $Actions.Contains($Drive) using contains returns False with $Drive specified .

    The rest works perfect 🙂

    I was wondering if those two scheduled tasks that are created when you enable VSS on the drive will run also with my scheduled task that I specified in cVSSTaskScheduler ??

    Thanks for sharing .



Leave a Reply