Design Question: Controller Script

Welcome Forums General PowerShell Q&A Design Question: Controller Script

This topic contains 1 reply, has 2 voices, and was last updated by

11 months, 2 weeks ago.

  • Author
  • #95019

    Points: 0
    Rank: Member

    I am automating a rather large business. Currently I have all tasks created as advanced functions and saved in different modules. I am writing a controller script to validate, manage, and execute all tasks that need to be completed. My controller script is growing rather lengthy.

    Is it a good practice to split out the controller script into separate .ps1 files and dot source each one at the time of execution?

    I want to make the controller script easy to maintain and manage going forward. Splitting different sections out into different .ps1's seems to make sense, but I was not sure if that is considered a bad practice. I would be curious to hear how others are handling these situations as well.

    Looking forward to your suggestions and feedback.

  • #95423

    Points: 305
    Helping Hand
    Rank: Contributor

    If you want to split it you could still use a module by dot sourcing the separate .ps1 files from a module file.
    Similar to this:

    Edit...seem like the URL is not visable from get go.
    But if you want to find an example just do a quick google 🙂

    Not sure what your use case is but what is the reason behind the controller script/module?
    If you're managing a large environment maybe looking into something like Powershell DSC, Ansible, Puppet, Chef etc. might be a better option rather than writing your own controller/orchestrator?

The topic ‘Design Question: Controller Script’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort