Changed the host name of a Hyper-V server and now all of your VM’s replication status is Critical? In the past you’d have to break replication and then rebuild it for every single VM letting them resynchronize which is just an absolute pain and resource/time consuming. Now we can use the PowerShell Set-VMReplication to fix the Replica Server’s changed name. You might not notice this right away if the old DNS was left to linger in DNS for some time. If it gets cleaned out automatically or someone deletes the old name your VMs might stop replicating. Right clicking a VM and viewing the replication health look at the Current Replica Server to see if the name there is the old name.
Set-VMReplication VM-Name Replica-Server-Name
Luckily this takes * as a wildcard for the VM-Name letting you alter all of your VMs. Examples;
Set-VMReplication VM01 server01.domain01.contoso.com
Set-VMReplication * server01.domain01.contoso.com
Once the value is changed I reset the replication history and reset the Hyper-V Manager service. I’m not 100% sure you have to restart the service but I did during testing because I missed one of the gotchas below before resolving it.
There are a couple of gotchas to watch out for.
- The system’s new name needs to be in DNS
- If you use SSL verification you need to make sure the SSL certificate has been updated to the new name
- If you use “Allow replication from the specified servers” option in the Hyper-V Settings of the host system you have to put the new system’s name in the allow list