Here’s another good one. The DSC configuration compiles without error, however, when running the resource and the resource has to change something (i.e. calling
[void] Set(), I get the lovely error:
Could not find the type of DSC resource class myClassBasedResource.
+ CategoryInfo : ObjectNotFound: (root/Microsoft/...gurationManager:String) , CimException
+ FullyQualifiedErrorId : ClassTypeNotFound
+ PSComputerName : LocalHost
I don’t know why it is the case, but the solution for me is to change
FunctionToExport in the resource’s .psd1 file.
FuntionsToExport = @('Get-Something','Start-Something','Write-MyBio') To:
FunctionsToExport = '*'
In my mind, this is not how it should be, not best practice, but until someone can explain why, I’ll have to live with it.
This isn’t the problem. It just appeared to be resolved, but when I ran
Import-Module myClassBasedResource -Force -Verbose the problem manifested itself again. It is to do with this: http://blog.thingsgeeky.co.uk/?p=10454. Still searching for a solution. At this point in time, I’ve had to move the DSCClassResources out of the parent resource.