DSC: (at runtime): Could not find the type of DSC resource class {resourceName}

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.

Change from: 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.


Update 1

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four 
    spaces will be stripped off, but all other whitespace
    will be preserved.
    
    Markdown is turned off in code blocks:
     [This is not a link](http://example.com)

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

For more help see http://daringfireball.net/projects/markdown/syntax

This site uses Akismet to reduce spam. Learn how your comment data is processed.