Custom class 5 DSCresources – share methods between DSC classes.

Welcome Forums DSC (Desired State Configuration) Custom class 5 DSCresources – share methods between DSC classes.

Viewing 1 reply thread
  • Author
    Posts
    • #50451
      Participant
      Topics: 21
      Replies: 43
      Points: 2
      Rank: Member

      Hi
      I have written a bunch of DSC resources for my SharePoint and SQL setup. I’ve been using the xsharepoint from github mainly. But I needed to set more settings, hence write my own.

      For SQL I have one psm1 file with DSCresources classes. Some of these DSCresources are using the same methods. so I have copied them to each class. I’m no programmer. So I am wondering if there is a was to “share” a method between my classes in this psm1 file.

      Any tips or recommendations are welcome.

      brgs

      Bjørn

    • #50463
      Keymaster
      Topics: 18
      Replies: 4872
      Points: 1,903
      Helping HandTeam Member
      Rank: Community Hero

      Not directly in the way you’re thinking, no. But, the design pattern for resources is to build all your functionality as standard PowerShell commands – cmdlets, functions, whatever. Your resources then just call those commands, which is what makes the code “shared” between them.

Viewing 1 reply thread
  • The topic ‘Custom class 5 DSCresources – share methods between DSC classes.’ is closed to new replies.