After a very successful DSC hackathon on Monday evening we reconvened on Tuesday morning with Steve Murawski delivering his second session on DSC.
A brief discussion on devops lead into looking at DSC configurations:
- Configuration names can’t be hyphenated
- Circular dependencies are detected
- Partial named configurations allow multiple configurations working against same machine
The morning’s second session was me talking about creating cmdlets from the CIM StdRegProv class using a CDXML approach. The talk started with using a single method and demonstrated how to add validation, simplify parameter input by the use of enumerations and how CDXML modules are used within PowerShell.
Dan Harman closed the morning session by talking about classes written in PowerShell – this functionality was introduced in the September preview of WMF 5
You can already define a class and load it with Add-Type but you have to write the class in C# or another .NET language. Now you can write the class in PowerShell
Classes can have overloaded constructors and methods. All class members are public by default.
Enums are possible. Scoping is lexical not dynamic as in PowerShell