Using a custom PowerShell Module inside of a Custom DSC Resource

Tagged: 

This topic contains 4 replies, has 2 voices, and was last updated by Profile photo of Aaron Stainback Aaron Stainback 9 months, 3 weeks ago.

  • Author
    Posts
  • #35095
    Profile photo of Aaron Stainback
    Aaron Stainback
    Participant

    What is the correct way of using a custom PowerShell Module inside of a Custom DSC Resource? Thanks.

  • #35116
    Profile photo of Don Jones
    Don Jones
    Keymaster

    Load 'er up and let 'er rip. Nothing really special.

  • #35117
    Profile photo of Aaron Stainback
    Aaron Stainback
    Participant

    Will they get downloaded from the Pull server just like DscResources?

  • #35119
    Profile photo of Don Jones
    Don Jones
    Keymaster

    Nope. However, because DSC itself doesn't "see" them, you can use a File resource to deploy them to the node. For example, start right off with the necessary File resources to grab the custom modules (from wherever, needn't be a pull server, just a file share is needed), and then make any resources that *use* those DependsOn the File resource. That gets the module local before it's called upon.

    You can also package modules within the Resource's folder structure, which means it'll travel along with the Resource, but that's only for situations where the module is tightly coupled to the Resource and wouldn't be used separately.

  • #35121
    Profile photo of Aaron Stainback
    Aaron Stainback
    Participant

    Thanks, that's exactly the info I was looking for.

You must be logged in to reply to this topic.