Creating PowerShell Modules, Tools and Controllers - at what point?

Changing content… Sorted it out.

It really comes down to the requirements. But before moving on, a tool does one thing only, and does it well.

PowerShell in itself can accomplish a massive variety of individual tasks, like Start-VM (and the list goes on) but it doesn’t have context built in - the how and why, and even when. That’s where the controller script comes in.

The controller script is taking your place as the decision maker and runs the tools based on some condition(s) in order to accomplish the goal. These tools can be native PowerShell cmdlets or your own advanced functions.

If a native cmdlet needs some manipulation, you can always write a wrapper function:

As you go through PowerShell MOL series (Toolmaking too), things will become clearer, and then move on to others like Windows PowerShell in Action.

To give an example, I wrote a tool called Send-FileToVimeo that has a -Path parameter, but under the hood, it’s actually passing the file path to a Vimeo API utility (CLI) that uploads the file to Vimeo. This allows me to upload a file easily without having to type the entire Vimeo API command and its options at the command line each time. It also provides for bulk uploads.

The same function sits inside a controller script that gets executed only after a bunch of other tasks have completed, including to check if the file exists before it gets uploaded.

A good tool is always available for individual use, and can also be integrated in controller scripts for broader workloads.