Skip to content

Ability to transistion from PowerShell script-based to class-based DSC resource #798

@Gijsreyn

Description

@Gijsreyn

Summary of the new feature / enhancement

As a resource author, I want the ability to transition between script-based to class-based DSC resources without losing backwards compatibility. The Microsoft.Windows/WindowsPowerShell should support both. However, the class-based is never hit in the adapter script because Get-DscResource from PSDesiredStateConfiguration v1.1 never implemented it.

This was tested with the Microsoft.Dotnet.Dsc module and SqlServerDSC. See image below:

Image

Note

The Microsoft.Dotnet.Dsc module has been modified to target 5.1 in the .psd1 file.

Looking directly in the source code of PSDesiredStateConfiguration, it reveals the following:

Image

Proposed technical implementation details (optional)

Instead of modifying the PSDesiredStateConfiguration, we can implement a small workaround to instantiate a class. If the class can be instantiated, we know it is a class-based DSC resource.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions