Posts

Showing posts with the label PowerShell

Stuff about SCVMM Templates

Revisiting previous code projects can be an exercise in hair-pulling. For example, in my previous blog post I mentioned creating a VM deployment script. Due to some issues with binaries, the need to revisit the code has come up recently, to add an option for creating VMs with a GUI, rather than as Core. The code worked when it was just dealing with one choice, but adding a very simple -InstallGui switch turned out to be a little more complex than originally thought. Constant errors stating the following were the main contention: New-SCVMTemplate : VMM is unable to process one or more of the provided cmdlet parameters. (Error ID: 1600) Needless to say, this is a bit non-specific! After a lot of frantic searching of blog posts and whatnot, and complete inability to find a relevant fix, I decided to scrape through the code and remove parameters one by one. Eventually, the Template parameter seemed to show up as a potential problem. Hmm. Inspecting the template I was intending...

What's up with my Config dude?

Image
When you want to know the current configuration of a DSC node you use the very aptly named Get-DscConfiguration cmdlet like so: PS C:\>Get-DscConfiguration -CimSession $target_node This cmdlet will execute the Get-TargetResource function for every configured resource on the node and return details on its current state like so: And life is good until you add a new resource to your configuration, push it to the target node and run the cmdlet again, only to be faced with an ugly exception like this: I know what you're thinking, "say whaaaat!!". You just want to see what the current config is and because of one dodgy resource you can't see anything - that sucks. However, the solution is quite simple. The words that stand out are key is not a valid property in the corresponding DSC resource schema file . The preceding word (AvailabilityGroupNameDatabase in this case) is the property that the resource Get-TargetResource function is ...