Hyper-V Certificate based Replication on Server Core using Powershell

Daniel Ivanov 1 Reputation point
2021-07-02T06:18:51.463+00:00

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):
https://medium.com/@pbengert/setup-2-hyper-v-2016-servers-enable-hyper-v-replica-with-self-created-certificates-and-connect-to-fceef21c8b8e

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://learn.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

Hyper-V
Hyper-V
A Windows technology providing a hypervisor-based virtualization solution enabling customers to consolidate workloads onto a single server.
2,546 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,383 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Ian Xue (Shanghai Wicresoft Co., Ltd.) 29,891 Reputation points Microsoft Vendor
    2021-07-02T07:25:08.697+00:00

    Hi,

    As the error message says the Replication is not enabled for the VM, you can enable replication of a VM using Enable-VMReplication.

    Enable-VMReplication -VMName "ProjectVM" -ReplicaServerName "server2" -ReplicaServerPort 5000 -AuthenticationType Certificate -CertificateThumbprint "4BFFF00509B97C782603F1DF3AF8C0399778FD70" -CompressionEnabled $true  
    

    Best Regards,
    Ian Xue

    ============================================

    If the Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments