ZertoPublic / ZertoApiWrapper

PowerShell wrapper for Zerto Virtual Manager API
GNU General Public License v3.0
15 stars 12 forks source link

Need a method to Set \ Modify VPG Parameters #99

Open wcarroll opened 4 years ago

wcarroll commented 4 years ago

Need a method to setup non-default settings for a VPG both when creating a VPG as well as any time a VPG needs to be modified after creation.

mattreba commented 1 year ago

I needed a way of modifying journal history settings on a large set of VPGs and was successful using the following method to update the existing VPGs. I thought I would share in case it was useful for others that are looking for this type of solution.

# Started with all VPGs in the site and performed some filtering (not shown to obtain a subset to process updates against)
$vpgs = Get-ZertoVPG
$updates = (# some filtered set of $vpgs ie $vpgs|?{$_.vpgName -like "Something*"})

$updates | % {
$setid = New-ZertoVpgSettingsIdentifier -vpgIdentifier $_.vpgIdentifier
$settings = Get-ZertoVpgSetting -vpgSettingsIdentifier $setid
$settings.Basic.JournalHistoryInHours = 1
$uri = "{0}/{1}" -f $baseUri,$setid
Invoke-ZertoRestRequest -uri $uri -method "PUT" -body $($settings| convertto-json -Depth 10)
$setid|Save-ZertoVpgSetting
}