Recently, I needed to be able to determine the total size for all the most recent full backups for certain servers. Luckily for me these particular servers were using Ola Hallengren’s Maintenance Solution which simplified things since each back up had it’s own specific directory. Powershell has the flexibility to easily provide what I need with little effort.
Let’s take a look!!
First, I usually prefer to have production backups stored separately from non-production backups however in this case this type of structure wasn’t feasible. All of the servers backed up to the same location, including DR servers. So, I needed a way to specify which exact directories I wanted to look through for the FULL backup files since they task was to only provide this information for production databases In order to facilitate this, I used a simple array of server names. Remember that with Ola’s solution each server will have its own parent folder effectively segregating the folders that I want away from the folders I don’t need.