PowerShell DSC Journey – Day 6

Yesterday I started working on a Custom DSC Resource for creating a SCVMM Hardware Profile. While I was at home last night I bit the bullet and made the decision that I was getting a bit ambitious with this and needed to start small. So, instead of all the Resource Properties I had yesterday, I have whittled my script down to what I have below. I kept Name because Name is the only required Parameter to create a new Hardware Profile in SCVMM.

Now, I am going to create a new DSC Resource. Luckily there is a handy command for that :). The DSCModules directory didn’t exist. I created it because it made sense to me to have a subfolder with my own resources in it instead of using the default directory.

First, let’s “run” the script so it can store the variables before I create my Resource. INCOMING WALL OF RED TEXT.

Well, that’s fun. You know what’s more fun? This.

Fail. I restart ISE and….

Well then. I am guessing that is based on the fact I have the Type for Name set to String[]. Looks like we are only allowing one name at a time! And this completely makes sense. How could you have a Key value and then allow multiple values? After I change the Type to string and run it, everything is good. Now let’s make our Resource.

Well, that’s going to be problematic.

Oh yeah, duh.

Well. Alright then. Setting a record for amount of red text per attempt to run a command I think.

Ok, the parameter is now called Property. Onward! Will the third time be the charm?

Alright! Now we are talking! I verify that the schema.mof and the .psm1 files exist and look like they should. I am going to leave off here because things are about to get real interesting when I try to write the Get,Set, and Test Functions here.