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

Welcome Forums General PowerShell Q&A Creating PowerShell Modules, Tools and Controllers - at what point?

Viewing 2 reply threads
  • Author
    Posts
    • #185582
      Participant
      Topics: 4
      Replies: 8
      Points: 95
      Rank: Member

      Changing content... Sorted it out.

    • #185588
      Participant
      Topics: 10
      Replies: 117
      Points: 457
      Helping Hand
      Rank: Contributor

      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: https://www.petri.com/making-powershell-command.

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

    • #185591
      Participant
      Topics: 10
      Replies: 117
      Points: 457
      Helping Hand
      Rank: Contributor

      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.

Viewing 2 reply threads
  • You must be logged in to reply to this topic.