PSDesiredStateConfiguration
PSDesiredStateConfiguration copied to clipboard
Get-DscResource doesn't identify the class based DSC resource
Prerequisites
- [X] Write a descriptive title.
- [X] Make sure you are able to repro it on the latest released version
- [X] Search the existing issues.
- [X] Refer to the FAQ.
- [X] Refer to Differences between Windows PowerShell 5.1 and PowerShell.
Steps to reproduce
Get-DscResource doesn't show class-based DSC resources if the PSD1 has all of these CmdletsToExport, FunctionsToExport, AliasesToExport. To mitigate the issues, one of them has to be commented. This is a bug introduced during the PowerShell performance related changes. Andrew Menagarishvili has looked into the code and confirmed this bug.
Expected behavior
Get-DscResources should return DSC resources
Actual behavior
Get-DscResource doesn't show the DSC resource
Error details
No error.
Environment data
Observed with OpenSSH V7.1+.
Visuals
Get-DSCResource doesn't show the class-based DSC resource
With workaround by commenting functionsToExport, Get-DscResource shows the class-based DSC Resource
Possible temporary workarounds until the bug is fixed:
- comment out any of CmdletsToExport / FunctionsToExport / AliasesToExport (for example, it it is an empty array)
- specify a wildcard for any of CmdletsToExport / FunctionsToExport / AliasesToExport
I have just experiences the issue and it took some time to find out what it was caused by that bug. Are there plans to fix it?
Related/Duplicate https://github.com/PowerShell/PSDesiredStateConfiguration/issues/101