Controlling the Hyper-V replica

For many of us will be Hyper-V replica in Windows Server 2012 very useful. The technique permits to small companies or datacenters to have a system online very quickly and with minimum investments. There are a lot of blogs and documents where it is explained how Hyper-V replica works, but at the same time I could not find any document how to implement monitoring.
This is why I wrote the script for sending the mail, if something goes wrong. This script (you can download it for free) sends a mail if there is any replication out of normal state. Of course, you can change the expression at your own choice and use it in your environment.

 Hyper-V Replica SendMail.zip (1.09 kb).