Search code examples
powershelldsc

Installing a dependent module that my team wrote


How do I tell DSC that a resource/module from our internal code repository (not on a private Gallery feed), first?

Do I just use a basic Script Resource and bring the files down (somehow) into $PSModulePath and import them?

Update

There's a CmdLet called Get-DSCResource that will list the available resources on a system, i.e. that reside in the correct path(s), and provide some information that can be used with Import-DscResource, which is a 'dynamic keyword' that is placed within a Configuration block in a DSC script to declare the dependencies.

As for getting the resources/modules down to the target system, I'm not sure yet.


Solution

  • If you are using a dsc pull server then you just need to make sure that your custom module(s) are on that server. I usually put them in program files\windowspowershell\modules.

    In the configuration you can just specify that you want to import your custom module and then proceed with the custom dsc resource

    Configuration myconfig {
      Import-DSCResource customModule 
        Node somenode {
          customresource somename {
    
      }
    
     }
    }
    

    If you dont have a pull server and you want to push configurations then you have to make sure that your custom modules are on all target systems. you can use the DSC file resource to copy the modules or maybe just use a ps script or any other means to copy them and then use DSC for your custom configurations.