Powershell’s Switch Statement

Shane O’Neill shows us Powershell’s switch statement:

We send out notification emails if jobs fail as well but hey, we’re DBAs, we like a backup!

Since this used to be done manually, and since I like PowerShell, I created separate functions that can take individual log files and parse out the needed data in a nice, easy format.

My problem, and the reason for this post, was figuring out, based on the name of the file in a directory, which function to call…

Click through to see how to use the switch statement, as well as how to switch on an expression.

Related Posts

Initial Thoughts On dbachecks

Jess Pomfret has an initial use case for dbachecks: Each check has one unique tag which basically names the check and then a number of other tags that can also be used to call a collection of checks. For this example we are going to use several checks to ensure that we meet the following […]

Read More

Introducing dbachecks

Chrissy LeMaire announces that the dbatools team is onto something big: dbachecks is a framework created by and for SQL Server pros who need to validate their environments. Basically, we all share similar checklists and mostly just the server names and RPO/RTO/etc change. This module allows us to crowdsource our checklists using Pester tests. Such checks include: […]

Read More

Categories

October 2017
MTWTFSS
« Sep Nov »
 1
2345678
9101112131415
16171819202122
23242526272829
3031