Hyper-V Certificate Based Replication under PowerShell

Hi guys,

We have server1 and server2 with Windows Server Core. One of them is with the virtual machines(server1), the other(server2) will be the replica server.

For creating certificates and importing them I followed this guide and it worked like a charm(check Step 3):

Next, I followed this guide to configure Hyper-V Certificate based Replication under PowerShell (no GUI), but I was unable to start the replication :

https://docs.microsoft.com/en-us/virtualization/community/team-blog/2012/20120423-enable-replication-using-certificate-based-authentication-in-powershell

I found an error in this documentation. For configuring replica server it says that you need to use the thumbprint of the CA which issued the certificates for both servers, but actually I had to use the thumbprint of the certificate for server2(replica server).

Next, I had to enable replication for VM regarding the guide, but when I run :

Set-VMReplication -VMName “ProjectVM” -ReplicaServerName “server2” -ReplicaServerPort 5000 -AuthenticationType Certificate -CertificateThumbprint “4BFFF00509B97C782603F1DF3AF8C0399778FD70” -CompressionEnabled $true

It says :

Set-VMReplication : Replication is not enabled for virtual machine with name ‘ProjectVM’.
At line:1 char:1

  • Set-VMReplication -VMName “ProjectVM” -ReplicaServerName “replicaNode” -R …
  •   + CategoryInfo          : InvalidOperation: (:) [Set-VMReplication], VirtualizationException
      + FullyQualifiedErrorId : InvalidState,Microsoft.HyperV.PowerShell.Commands.SetVMReplication
    
    

I tried both: 5000 and 443, but still I get the same error.
And I tried with both - CA certificate thumbprint and server2 certificate thumbprint, but still I get the same error.

Please, advice!

Regards,
Daniel

Enable-VMReplication

I get this:

PS C:\Users\Administrator> Enable-VMReplication

cmdlet Enable-VMReplication at command pipeline position 1
Supply values for the following parameters:
VMName[0]: VM1
VMName[1]:
ReplicaServerName: server2
ReplicaServerPort: 443
AuthenticationType: certificate -certificateThumbprint “myThumbPrint”

Enable-VMReplication : Cannot bind parameter ‘AuthenticationType’. Cannot convert value “certificate
-certificateThumbprint MyThumbPrint” to type
“Microsoft.HyperV.PowerShell.ReplicationAuthenticationType”. Error: “Unable to match the identifier name certificate
-certificateThumbprint MyThumbPrint to a valid enumerator name. Specify one of the
following enumerator names and try again:
Kerberos, Certificate”
At line:1 char:1

  • Enable-VMReplication
  •   + CategoryInfo          : InvalidArgument: (:) [Enable-VMReplication], ParameterBindingException
      + FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.HyperV.PowerShell.Commands.EnableVMReplication