PowerShell Stuff

What I hate about so many PowerShell scripts out there today is they are either a partial snippet, or assume you have installed some module and that your PowerShell setup has bee up and running for years, and you have so many extra prerequisites and settings that the new PowerShell user does not have, and they struggle to catch up.

The other assumption I see is you have references to *,psm1 files in a specific location, that may not match your own when you download someone else’s code to test.

My code my not be the most documented, but my style is like this:

the whole script is self contained and assumes PowerShell 5.1, and will an obnoxious number of if-not-loaded prerequisites at the top.

After prerequisites there is a block of functions to be declared and called later, followed by a block of all the variables that need to be modified for your individual use (i.e. SQL server name/database, emails, etc.

The last lines of the script are in a block called “The work” and do the actual effort the script is supposed to complete.