Wednesday, July 13, 2022

Using Powershell to send an email alert when a file type is found

A while back I had the privilege of working with a brilliant dev; Andrew Nesbit in helping sort out some processes for the Horizon ILS and how it would work with the Metro Library Card System (melibraries.ca).  I helped him with some of the Horizon work with how the different library systems work together more specifically SirsiDynix Symphony, polaris and Horizon.  

One issue that came out that I never got around to fixing till now was the creation of the .FAIL file that is generated if the server has a problem or there is some sort of incompatibility between library systems, such as pin, city name, password length, etc.  There is also an issue with the service stopping without notice; which also creates a .FAIL file as shown below.

Metro FAIL file.  Dead Process



Metro FAIL file.  FAILED User


So I decided to finally write a powershell script to send me an alert when this happens.  So it looks in the directory where the Me Server saves it's logs; and I have powershell checking that directory as shown below.  The script uses powershell to check for a .FAIL file in the log directory and then sends a send-mail message.  I know that this is depreciated and I will have to update this sooner then later; but it will work for the purpose I need for now.

Hyper-V VM Backup using Powershell (VM-Export)

One of the many things I've been working on is an automated script to do VM backups.  I've been doing a lot of work automating proce...