So live your life that the fear of death can never enter your heart. Trouble no one about their religion; respect others in their view, and demand that they respect yours. Love your life, perfect your life, beautify all things in your life. Seek to make your life long and its purpose in the service
PowerShell DSC Journey – Day 21
Alright, when I left off I had added in some testing for the $Credential Property of the Resource in the Get-TargetResource and Test-TargetResource functions. Today I am going to do the same with Set-TargetResource, and then test my Configuration to see what I did wrong. If I survive that I will try to create a
PowerShell DSC Journey – Day 20
When I left off yesterday I was trying to actually run a Configuration to create a Hardware Profile, and quickly realized that I was going to need a Credential parameter in order to do this, because not just anyone can connect to a Virtual Machine Manager server. So today’s post is going to be about
PowerShell DSC Journey – Day 19
Alright, so in my last post I was able to resolve the issue with my Custom Resource not showing up under Get-DSCResource (because as usual I was doing something dumb). Proof!
1 2 3 4 5 6 |
PS C:\Scripts> Get-DscResource ImplementedAs Name Module Properties ------------- ---- ------ ---------- Binary File {DestinationPath, Attributes, Checksum, Content... PowerShell SCVMM_Hardware cSCVMM {Name, VMMServer, CPUCount, DependsOn...} |
Now, let’s try and write a Configuration! Look ma, no errors!
1 2 3 4 5 6 |
Configuration TestSCVMMHardware { Import-DscResource -Module cSCVMM } |
Let’s build this out for a test.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
Configuration TestSCVMMHardware { Import-DscResource -Module cSCVMM node localhost { SCVMM_Hardware MyHardwareProfile { VMMServer = "SC-VMM01" CPUCount = 2 DVDDrive = $True Ensure = "Present" Name = "Jacobs Profile" VMNetwork = "Server Traffic" } } } TestSCVMMHardware |
I run this
PowerShell DSC Journey – Day 18
Yesterday I finished up modifying the Set-TargetResource function and doing all the tests and it seems to be working exactly the way that I want. The next step today is to turn this into a module, import it, write a DSC Configuration and see if it actually works. I already have my SCVMM_Hardware.psm1 file, so
PowerShell DSC Journey – Day 17
Alright. So yesterday I worked through some issues in the Set-TargetResource Function and left off with a big one still remaining. Namely, that even though I have Ensure = Present in my test of the Function, it is running through the Ensure = Absent portion of the script if the Hardware Profile already exists, which
PowerShell DSC Journey – Day 16
When I left off yesterday I had a somewhat functioning Set-TargetResource function. I use functioning in the way that when something kind of works and doesn’t throw errors but doesn’t actually do anything functions. So, today I am going to be figuring out where I screwed up my logic and getting this Resource to work.
PowerShell DSC Journey – Day 15
So when I left off yesterday I appeared to have my Get and Test TargetResource functions working properly, now it’s time to work on the Set-TargetResource function, which is probably where the fun will happen. When I go to set the Resource, I have a couple of different scenarios I need to work through. Hardware
PowerShell DSC Journey – Day 14
When I left off yesterday, I had modified my Get-TargetResource to work (hopefully) with all the new properties I had setup for my Custom Resource. Now, I am going to test this, and DSC willing I will be able to move on to the Target Resource functions today before I finish this thing out. First
PowerShell DSC Journey – Day 13
When I left off yesterday I had a functioning Custom Resource. By functioning I mean that I can run some tests without errors (unless it should error) and that it can create a new Hardware Profile name if one doesn’t exist. Other than that, it’s pretty much worthless. So, let’s add in a few more