diff --git a/ZertoApiWrapper/Public/Copy-ZertoVpg.ps1 b/ZertoApiWrapper/Public/Copy-ZertoVpg.ps1 index 3a22c37..4608c6e 100644 --- a/ZertoApiWrapper/Public/Copy-ZertoVpg.ps1 +++ b/ZertoApiWrapper/Public/Copy-ZertoVpg.ps1 @@ -49,7 +49,9 @@ function Copy-ZertoVpg { if ($PSCmdlet.ShouldProcess("$VMsToAdd", "Copying $SourceVpgName to $NewVpgName with Settings")) { $NewVpgId = Invoke-ZertoRestRequest -Uri $BaseUri -Body ($VpgIdToCopy | ConvertTo-Json) -Method "POST" $Uri = "{0}/{1}/vms" -f "vpgSettings", $NewVpgId - $null = Invoke-ZertoRestRequest -Uri $Uri -Body ($VMsToAdd | ConvertTo-Json) -Method "POST" + foreach ($VM in $VMsToAdd) { + $null = Invoke-ZertoRestRequest -Uri $Uri -Body ($VM | ConvertTo-Json) -Method "POST" + } $Uri = "vpgSettings/{0}" -f $NewVpgId $CurrentSettings = Invoke-ZertoRestRequest -Uri $Uri $CurrentSettings.Basic.Name = $NewVpgName