Fix Bug when Adding Additional VMs

This commit is contained in:
Wes Carroll
2019-11-07 22:35:40 -05:00
parent 5b8a89e1a3
commit d6862f75d1
+3 -1
View File
@@ -49,7 +49,9 @@ function Copy-ZertoVpg {
if ($PSCmdlet.ShouldProcess("$VMsToAdd", "Copying $SourceVpgName to $NewVpgName with Settings")) { if ($PSCmdlet.ShouldProcess("$VMsToAdd", "Copying $SourceVpgName to $NewVpgName with Settings")) {
$NewVpgId = Invoke-ZertoRestRequest -Uri $BaseUri -Body ($VpgIdToCopy | ConvertTo-Json) -Method "POST" $NewVpgId = Invoke-ZertoRestRequest -Uri $BaseUri -Body ($VpgIdToCopy | ConvertTo-Json) -Method "POST"
$Uri = "{0}/{1}/vms" -f "vpgSettings", $NewVpgId $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 $Uri = "vpgSettings/{0}" -f $NewVpgId
$CurrentSettings = Invoke-ZertoRestRequest -Uri $Uri $CurrentSettings = Invoke-ZertoRestRequest -Uri $Uri
$CurrentSettings.Basic.Name = $NewVpgName $CurrentSettings.Basic.Name = $NewVpgName