- This topic has 2 replies, 2 voices, and was last updated 1 month, 1 week ago by
October 30, 2019 at 1:15 am #185582ParticipantTopics: 4Replies: 8Points: 95Rank: Member
Changing content... Sorted it out.
October 30, 2019 at 2:10 am #185588ParticipantTopics: 10Replies: 117Points: 457Rank: 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.
October 30, 2019 at 2:27 am #185591ParticipantTopics: 10Replies: 117Points: 457Rank: Contributor
To give an example, I wrote a tool called
Send-FileToVimeothat has a
-Pathparameter, 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.
- You must be logged in to reply to this topic.