• This topic has 3 replies, 2 voices, and was last updated December 16, 2021 by Michael S.

Powershell VPG mgmt has unexpected results

  • First of all, this script doesn’t update $_.Recovery.DefaultFolderIdentifier like it was meant to.
    Second, it removes $_.Recovery.DefaultDatastoreIdentifier even if I try to put a value.

    Can anyone tell me what’s going on?

    $BaseURL = “https://zvm_ip:port/v1/”

    $VPGListUrl = $BaseURL+”vpgs”
    $VPGList = Invoke-RestMethod -Method GET -Uri $VPGListUrl -Headers $ZertoSessionHeader -ContentType $TypeJSON
    $VPGIdentifier = $VPGList[0].VpgIdentifier

    $JSONIdentifier = @{VpgIdentifier = “$VPGIdentifier”} | ConvertTo-Json

    $VPGSettingsIdentifierUrl = $BaseURL+”vpgsettings”
    $VPGSettingsIdentifier = Invoke-RestMethod -Method POST -Uri $VPGSettingsIdentifierUrl -Body $JSONIdentifier -Headers $ZertoSessionHeader -ContentType $Type

    $VPGSettingsUrl = $BaseURL+”vpgsettings/”+$VPGSettingsIdentifier
    $VPGSettings = Invoke-RestMethod -Method GET -Uri $VPGSettingsUrl -ContentType $TypeJSON -Headers $ZertoSessionHeader

    $VPGJSON = @{Recovery = @{DefaultFolderIdentifier = “$RecoveryFolder”}} | ConvertTo-Json

    $VPGSettingsPutURL = $BaseURL+”vpgSettings/”+$VPGSettingsIdentifier+”/recovery”
    $VPGSettingsPut = Invoke-RestMethod -Method PUT -Uri $VPGSettingsPutURL -Body $VPGJSON -ContentType $TypeJSON -Headers $zertosessionHeader

    $VPGCommitUrl = $BaseURL+”vpgsettings/”+$VPGSettingsIdentifier+”/commit”
    $VPGCommit = Invoke-RestMethod -Method POST -Uri $VPGCommitUrl -Headers $ZertoSessionHeader

    Hello Michael,

     

    Ben from Zerto Support here.

    We would like to investigate this issue further.

    Could you please open a support case?

     

    More info on Support cases can be found in this article:

    https://help.zerto.com/kb/000004662

     

    Thanks.

    Thanks Ben

    A case was created with the following details:
    Case Subject: “Powershell VPG mgmt has unexpected results”
    Case #00195567

     

    A dev request has been created by support to address this.

    The current workaround is to always post the DefaultHostClusterIdentifier and the DefaultDatastoreIdentifier along with the information you need to update. For me, I had to post the following to change just the DefaultFolderIdentifier.

    {
    “DefaultDatastoreIdentifier”:”String content”,
    “DefaultHostClusterIdentifier”:”String content”,
    “DefaultFolderIdentifier”:”String content”
    }

You must be logged in to create new topics. Click here to login