Custom Resource Not Found by Get-DSCResource

Welcome Forums DSC (Desired State Configuration) Custom Resource Not Found by Get-DSCResource

This topic contains 2 replies, has 2 voices, and was last updated by

4 years, 8 months ago.

  • Author
  • #16363

    Points: 21
    Rank: Member

    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

    Points: 1,811
    Helping HandTeam Member
    Rank: Community Hero

    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

    Points: 21
    Rank: Member

    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!

The topic ‘Custom Resource Not Found by Get-DSCResource’ is closed to new replies.

One thought on “Custom Resource Not Found by Get-DSCResource

  1. Pingback: PowerShell DSC Journey – Day 18 | Jacob Benson

Comments are closed.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort