From 8f735bee6249550b639c5bcb28bda7737406eb82 Mon Sep 17 00:00:00 2001 From: Wes Carroll Date: Sun, 17 May 2020 11:04:41 -0400 Subject: [PATCH] Correct body creation method --- ZertoApiWrapper/Public/Start-ZertoCloneVpg.ps1 | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ZertoApiWrapper/Public/Start-ZertoCloneVpg.ps1 b/ZertoApiWrapper/Public/Start-ZertoCloneVpg.ps1 index ae95a22..be8f999 100644 --- a/ZertoApiWrapper/Public/Start-ZertoCloneVpg.ps1 +++ b/ZertoApiWrapper/Public/Start-ZertoCloneVpg.ps1 @@ -27,18 +27,25 @@ function Start-ZertoCloneVpg { ) begin { + + } + + process { $baseUri = "vpgs" $vpgInfo = Get-ZertoVpg -name $vpgName if ( -not $vpgInfo ) { Write-Error "VPG: $vpgName could not be found. Please check the name and try again." } $vpgIdentifier = $vpgInfo.vpgIdentifier + $body = @{ } if ( $PSBoundParameters.ContainsKey('datastoreName') ) { $recoverysiteIdentifier = $vpgInfo.recoverysite.identifier $recoverySiteDatastores = Get-ZertoVirtualizationSite -siteIdentifier $recoverysiteIdentifier -datastores $datastoreIdentifier = $($recoverySiteDatastores | Where-Object { $_.datastoreName -like $datastoreName }).DatastoreIdentifier if ( -not $datastoreIdentifier ) { Write-Error "Datastore: $datastoreName is not a valid datastore. Please check the name and try again." -ErrorAction Stop + } else { + $body['DatastoreIdentifier'] = $datastoreIdentifier } } if ( $PSBoundParameters.ContainsKey('vmName') ) {