Custom Resource Not Found by Get-DSCResource

This topic contains 2 replies, has 2 voices, and was last updated by  Jacob Benson 4 years, 1 month ago.

  • Author
  • #16363

    Jacob Benson

    So, I have been working on a Custom Resource for a while now and when I finally went to test it in a Configuration, I come to find out that Get-DSCResource does not recognize it as a resource. The path to the resource is C:\Program Files\WindowsPowerShell\Modules\DSCResources\cSCVMM. No matter what I have tried, I cannot get Get-DSCResource to find it/recognize it/load it.

    Thinking I screwed something up, I just copied and pasted the example resource in this article ( and I have the same problem.

    I have tested this on WMF 4.0, WMF 5.0 Preview, Windows 8.1 and Server 2012 R2. I should also mention that when I run Test-xDSCSchema against the .MOF in either resource it returns true. Additionally I can load the module for my Custom Resource without any issue as well.

    Please tell me I am just missing something completely obvious?

  • #16366

    Don Jones

    Wrong folder structure.


    _modulename_ has to be a real module with at least a .PSD1. E.g., xNetworking.

    _resourcename_ is the actual resource, and must contain a .PSM1, the schema MOF, and usually a .PSD1. E.g., xIPAddress.

    You can't just have a \DSCResources under \Modules.

  • #16367

    Jacob Benson

    That sure enough did the trick. It looks my problem was that when I created the Resource I did this:

    New-xDscResource -Name cSCVMM_Hardware -Property $DVDDrive, $VMNetwork, $CPUCount, $Ensure, $Name, $VMMServer -FriendlyName "SCVMM_Hardware" -ClassVersion 1.0 -Path 'C:\Program Files\WindowsPowerShell\Modules\'

    This just created a DSCResources folder, and then put everything underneath of it, which caused me to be off a whole level. I should have done it this way:

    New-xDscResource -Name cSCVMM_Hardware -Property $DVDDrive, $VMNetwork, $CPUCount, $Ensure, $Name, $VMMServer -FriendlyName "SCVMM_Hardware" -ClassVersion 1.0 -Path 'C:\Program Files\WindowsPowerShell\Modules\cSCVMM'

    Lesson learned! Thank you!

You must be logged in to reply to this topic.