The DSC resource definition file

A DSC resource definition file is an MOF schema file that has a specific CIM syntax, whose name is <DSCResourceName>.schema.mof. In the previous section, our example of xTimeZone had an MOF schema file called xTimezone.schema.mof. It is at first very obtuse and unfriendly to look at but becomes easier to read the more you work with it. The MOF files are supposed to be easy for the machine to read and not you, so there is some initial effort in understanding the syntax and format for them. Don't worry too much about this as you aren't meant to look at it yourself much. MOF schema files are expected to be automatically created and updated using the DSC tooling that Microsoft has released.

The main purpose of a DSC resource MOF schema file is to provide the name and version of the DSC resource and declare the parameters the DSC resource will accept. An example of a DSC resource MOF schema file is as follows:

[ClassVersion("1.0.0"), FriendlyName("InstallFoo")]
class Example_InstallFoo: OMI_BaseResource
{
[Key] string Name;
[Required] string PhysicalPath;
[write,ValueMap{"Present", "Absent"},Values{"Present", "Absent"}] string Ensure;
};

If you are reading CIM syntax, class names, and writeable values and starting to sweat, don't worry. Your fears will be allayed in the Creating PowerShell class-based custom DSC resources section.
There is still some benefit in going over the syntax of the MOF schema file, as you might have to troubleshoot issues in parsing when creating your own DSC resources or troubleshooting DSC resources created by others. If this section is getting through to you, you can reference it later when the time comes.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset