Starting with PowerShell version 5.0, you can use PowerShell class definitions to create Desired State Configuration (DSC) Resources.
To aid in building DSC Resource, there's a
[DscResource()] attribute that's applied to the class definition, and a
[DscProperty()] resource to designate properties as configurable by the DSC Resource user.
A class-based DSC Resource must:
Test()method that returns
Get()method that returns its own object type (eg.
Set()method that returns
After creating a class-based PowerShell DSC Resource, it must be "exported" from a module, using a module manifest (.psd1) file. Within the module manifest, the
DscResourcesToExport hashtable key is used to declare an array of DSC Resources (class names) to "export" from the module. This enables consumers of the DSC module to "see" the class-based resources inside the module.