PSDesiredStateConfiguration icon indicating copy to clipboard operation
PSDesiredStateConfiguration copied to clipboard

Enable `export` for class-based resources

Open SteveL-MSFT opened this issue 1 year ago • 1 comments

Summary of the new feature / enhancement

Enable class-based resources to participate in DSCv3 export capability

Proposed technical implementation details (optional)

No response

SteveL-MSFT avatar Jan 11 '24 17:01 SteveL-MSFT

The PowerShell adapter for DSCv3 is implemented to support export for PSDSC Resources when the resource has a static Export method that takes no parameters and returns an array of the PSDSC Resource class.

https://github.com/PowerShell/DSC/blob/0157276b2ada32da5859ce930f4cae2e592f586c/powershell-adapter/psDscAdapter/psDscAdapter.psm1#L296-L301

Following is an example signature for the Export method, using MyDscResource as the class name:

static [MyDscResource[]] Export() {
    # Code to return the array of all instances for the resource
}

However, the PSDesiredStateConfiguration module doesn't know about or handle the Export method at all.

michaeltlombardi avatar Apr 29 '24 15:04 michaeltlombardi