Hyper-V replication remove Disk

Welcome Forums General PowerShell Q&A Hyper-V replication remove Disk

This topic contains 2 replies, has 2 voices, and was last updated by

 
Participant
2 months, 2 weeks ago.

  • Author
    Posts
  • #164421

    Participant
    Topics: 1
    Replies: 1
    Points: 21
    Rank: Member

    Hyper-V 2019, Server 2019

    VM has four VHDXs. Need to remove two from replication.

    Compiled statement:

    Set-VMreplication "Server" -ReplicatedDisks (Get-VMHardDiskDrive "Server" -ControllerType SCSI -ControllerNumber 0 -ControllerLocation 2).

    This will remove Disks from ControllerLocation 0,1,3 But I need to remove from 1 too.

    How would I construct it?

  • #164485

    Senior Moderator
    Topics: 8
    Replies: 1041
    Points: 3,440
    Helping Hand
    Rank: Community Hero

    This will remove Disks from ControllerLocation 0,1,3 But I need to remove from 1 too.

    Confused, can you make this lil more clear ?

    • #165064

      Participant
      Topics: 1
      Replies: 1
      Points: 21
      Rank: Member

      Hi Karunan,

      I was trying to figure out commands to replicate only certain disks after replication is enabled without breaking it.

      Figured it out.

      Command that I used:

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

      So to replicate all disks – Set-VMreplication "VMname" -ReplicatedDisks (Get-VMHardDiskDrive "VMname")

      To replicate only certain disks – add (Get-VMHardDiskDrive "VMname" -ControllerType SCSI -ControllerNumber 0 -ControllerLocation 0) and repeat same line for each disk, changing the location or type or controller depending on your situation. Put a comma between each parantasy.

      Sorry if it's not clear.

You must be logged in to reply to this topic.