Post TSM Logs to Slack

Using TSM as your backup solution, the way to know if your backup is ok is to check the logs. Now we all know that going through logs on a bunch of servers isn’t that much fun.
Let’s use PowerShell to read the logs, parse out the good stuff and post it to Slack instead.

All that is needed, enter your servers and update the webhook URL

The script will loop through the servers and read the logs.
The interesting part is between
— SCHEDULEREC STATUS BEGIN and
— SCHEDULEREC STATUS END

If STATUS BEGIN is not found a warning is posted instead.

The script (Send-TSMLogToSlack.ps1) is available on Github

This is what it looks like.

 

I have scheduled this to run every morning.
So I can sit back and enjoy that morning coffee while scrolling through the log channel.

Restore From TSM

When using TSM as your backup solution, the GUI is not the fastest way to do your restore. IBM even recommends using the command line when restoring a large amount of data. So, let’s do that.

The syntax for dsmc is not the easiest to remember, for example, to restore all under D:\Data this would be the command for the latest version.

C:\Program Files\Tivoli\TSM\baclient\dsmc.exe restore -inactive -subdir=yes D:\Data\* E:\Restore\

or, to restore from last week it would look like this

C:\Program Files\Tivoli\TSM\baclient\dsmc.exe restore -inactive -subdir=yes -pitd=04/07/17  D:\Data\* E:\Restore\

Let’s simplify this with a PowerShell wrapper.

Restore-TSMBackup.ps1

I’m using Start-Process to run dsmc, this allows me to redirect the output. I’ve chosen to put it in a text file in the Temp folder.
When the restore is completed, read the file and show the summary.

Output from script

 

The script is available on GitHub