Powershell DSC manifest for subfolders

16 Views Asked by At

I am trying to create a Powershell module with class based DSC resource organized in sub folders. Something like this:

-MyModuleDsc
 \-DSCResources
   \-DSC_ManageVm
     |- DSC_ManageVM.psm1
|- MyModuleDsc.psd1

So the DSC_ManageVM.psm1 has actual implementation of:

 [DscResource()] 
 class ManageVm {
   Get()
   Set()
   Test()
 }

So in main MyModuleDsc.psd1 I defined:

@{

    RootModule = ''   
    ...
    ...
    NestedModules = @(
        '.\DSCResources\DSC_ManageVm\DSC_ManageVM.psm1'
    )
    ...
    ...
    DscResourcesToExport = @( ???? )

but how I should define DscResourcesToExport property

If I define it as DscResourcesToExport = @('ManageVm') then I receive an error while trying to Invoke-DscResource with message that:

Invoke-DscResource: Resource ManageVm was not found as one of the builtin resources. Please add -ModuleName parameter to include external resources.

So how I should define the DscResourcesToExport ? The idea is to keep adding new DscResource() classes each in it own subfolder

0

There are 0 best solutions below