How To Add Or Remove any specific disk from Hyper-V replication (hot add/remove)

Starting from windows 2016 the same command to create replication is the one to remove disks, when running the command the replication will hot add/remove any disk you specified, if you add specific disk, the other will be excluded ! here some example (execute Powershell on the host):

To add/update all the disk on the VM to the replication :

Set-VMreplication VMName -ReplicatedDisks (Get-VMHardDiskDrive VMName)

To add specific disk ,only this disk will be add to the replication, the other will be excluded :

Set-VMreplication "VMname" -ReplicatedDisks (Get-VMHardDiskDrive "VMname" -ControllerType SCSI -ControllerNumber 0 -ControllerLocation 0)

To add/update mote then one disk, just add additional location with comma to separate :

Set-VMreplication "VMname" -ReplicatedDisks (Get-VMHardDiskDrive "VMname" -ControllerType SCSI -ControllerNumber 0 -ControllerLocation 0), (Get-VMHardDiskDrive "VMname" -ControllerType SCSI -ControllerNumber 0 -ControllerLocation 2)

When changing disks on the replication disk list you should concider some time to let the disk re-replicate and merging (shown in the hyper-v manager)

Good Luck

One Comment

  • Jason says:

    Greetings, This does not appear to flow through to extended replication. When attempting to issue this command on the replica server where extended replication is set there is an error stating this command must be issue on the primary server. One can just remove and re-enable extended replication but this may be an issue for some.

Leave a Reply

Your email address will not be published. Required fields are marked *