If you know me, you already know that I’m a huge fan of automation. Therefore, it’s natural to assume that I would dabble in Powershell at least once or twice or a few dozen, as a method to implement useful automations. After all, automation is pretty much the whole essence of Powershell in the first place.
As I used Powershell scripts more and more, I learned that there are a few things that are important to have whenever you use such scripts as part of automation (by “automation” I mean any sort of operation done “unattended”, i.e. without direct human interaction in real-time).
And so, a script template was born…
Taking all of what I learned and more, I wrote for myself a few handy Powershell scripts that I use as a “template” of sorts. Every time I need to start writing a new script for automation, I take a copy of that template, and add the relevant body of script that I need.
I have a few such scripts that can be downloaded from the Madeira Toolbox GitHub repository:
It’s important to remember that these “template” scripts are nothing more than good “starting points“.
As such, it’s likely that you may have to add some of your own changes in order to make them fit whatever it is you intend to do with them.
Don’t treat them like a strict form to fill out. But more like a pliable piece of dough that you can turn into any shape or form.
As always, your mileage may vary.
For more details on these template scripts, please read the full post at the Madeira Data Solutions blog.
Pingback: T-SQL Tuesday 143 – Short Powershell code to move DB files in AlwaysOn – Eitan Blumin's Blog