Using a custom PowerShell Module inside of a Custom DSC Resource

Welcome Forums DSC (Desired State Configuration) Using a custom PowerShell Module inside of a Custom DSC Resource

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

 
Participant
2 years, 10 months ago.

  • Author
    Posts
  • #35095

    Participant
    Points: 0
    Rank: Member

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

  • #35116

    Keymaster
    Points: 1,674
    Helping HandTeam Member
    Rank: Community Hero

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

  • #35117

    Participant
    Points: 0
    Rank: Member

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

  • #35119

    Keymaster
    Points: 1,674
    Helping HandTeam Member
    Rank: Community Hero

    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

    Participant
    Points: 0
    Rank: Member

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

The topic ‘Using a custom PowerShell Module inside of a Custom DSC Resource’ is closed to new replies.