Hyper-V 2012 R2- Replica Email Notification Script

Here is an example Hyper-V replica email notification script. Scenario is Hyper-V cluster replicating business critical VMs to a single Hyper-V host. The script can be ran as a scheduled task on the DR Hyper-V host to send email notifications. The account running the script must have Hyper-V permissions. Script: Hyper-V 2012 Replica Email Script # Created by Chris Hayward # Purpose - To send a daily email displaying Hyper-V Replica status # Version 1.0 # Get date in UK format day/month/year $date = Get-Date -Format dd/MM/yy # Variables $MailFrom = 'hyperv_replica@yourdomain.com' $MailTo = 'you@yourdomain.com' $MailSubject = "Hyper-V Replica Report $date" $MailServer = 'smtp.yourdomain.coml' # Get replication status in HTML format $status = Get-VMReplication | Select-Object Name, State, Health, Mode, FrequencySec, PrimaryServer, ReplicaServer, ReplicaPort | ConvertTo-Html # Send email message Send-MailMessage -From $MailFrom -To $MailTo -Subject $MailSubject -BodyAsHtml -Body "$status" -SmtpServer $MailServer Example output: ...

17 November 2015 · 1 min · Chris Hayward

Windows Server 2012 R2 – Add cluster node / Cluster Service "Keyset does not exist"

I recently came across an error where the Cluster Service stopped on a Windows Server 2012 R2 failover cluster and would not start. Event Logs generated were: Event ID: 7024 The Cluster Service service terminated with the following service-specific error: Keyset does not exist Event ID: 7031 The Cluster Service service terminated unexpectedly. It has done this 282 time(s). The following corrective action will be taken in 60000 milliseconds: Restart the service. ...

2 July 2015 · 2 min · Chris Hayward