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.
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?