PowerShell DSC Journey – Day 10

When we left off yesterday I believed that I had a functioning Get-TargetResource function, without yet actually getting to the part where I Get anything. Which begs the question whether or not I actually need all that other stuff in there, or if it belongs in the Test-TargetResource. I honestly have no idea, I am just working off of the examples I have at my disposal. So, let’s see today if we can get some stuff returned!

Looking through examples of existing DSC Resources, I don’t see Ensure or DependsOn anywhere, except in what appears to be one special case, so I guess DSC just knows how to use them? I looked at some of Steve Murawski’s Stack Exchange Resources and that just confused me even more so I am just going to keep plugging along here. I am going to set Ensure = “Present” because the Hardware Profile should already exist (I guess?). When I get further along into creating a new Hardware Profile I imagine I will need to set this to “Absent” if the Hardware Profile does not exist. So, this is what I have.

And if I run one my Test-TargetResource functions that I know should work, here is what I get:

HOLY CRAP IT WORKED ON THE FIRST TRY AND I AM REALLY EXCITED AND YOU CAN’T MAKE ME STOP TALKING IN ALL CAPS!!!! Well, that’s all for today, we will pick it up tomorrow with working on the Test-TargetResource.