build 6ddc7a35 | content blog-content@417154f · 338 posts | profiles 32 · corpus 315 | ● 0 skipped | format run

$ soultec get post/zerto-automating-vpg-journal-limit-changes -o yaml$ soultec get post/zerto-automating-vpg-journal-limit-changes -o json$ soultec get post/zerto-automating-vpg-journal-limit-changes -o toml$ soultec get post/zerto-automating-vpg-journal-limit-changes -o xml$ python3 zerto-automating-vpg-journal-limit-changes.pyPS> ./zerto-automating-vpg-journal-limit-changes.ps1$ go run zerto-automating-vpg-journal-limit-changes.go$ node zerto-automating-vpg-journal-limit-changes.js

apiVersion: soultec.ch/v1kind: Postmetadata: name: zerto-automating-vpg-journal-limit-changes locale: en labels: author: dario-doerflinger capability/backup-recovery: 2.14 vendor/vmware: 0.98 annotations: source: blog-content/posts/en/zerto-automating-vpg-journal-limit-changes.md route: /en/insights/zerto-automating-vpg-journal-limit-changes/ schema: /nerd/schema/posts.json markdown: /en/insights/zerto-automating-vpg-journal-limit-changes.mdspec: title: Automating VPG journal limit changes date: 2018-06-06 author: dario-doerflinger locale: en summary: I helped one of our customers implement Zerto in their environment. capabilities: [backup-recovery] vendors: [vmware] legacySlug: zerto-automating-vpg-journal-limit-changes migrated: 2026-08-24 draft: false sections: - body: | I helped one of our customers implement Zerto in their environment. When you deploy Zerto and start protecting your VMs with it you need to know which applications you want to group together into virtual protection groups (VPGs). Another thing you'd define beforehand would be how many days you would want to be able to go back in time with Zerto and use that as a base to define the journal size limit of your VPGs. Now, some VMs produce a lot of I/Os while other are basically silent. This is key in how much space they are going to use and need in their VPG. So while for most of your VPGs the intially defined limit will be sufficient to reach your desired amount of time to go back it will not nearly be enough for your most I/O intensive workloads. When you then go ahead and change the journal limit on this VPG it will NOT update this setting on VMs that are already inside this VPG. When we first noticed this we thought this must be a bug and opened a case with Zerto. The support engineer then told us that this is not a bug but rather it's a feature… The customer and we had a different view on that so we started looking at the zerto API to remedy this unsatisfying situation. Long story short: Below is a script that will enable you to change the journal limit on a VPG and then iterate through all VMs in that VPG and set the same values (makes perfect sense in our use-case). Update: this script is now published at [GitHub](https://github.com/virtualFrog/PowerCLI-Scripts). ```powershell param( [Parameter(Mandatory = $true)][string]$zvm = "zvm.virtualfrog.wordpress.com", [Parameter(Mandatory = $true)][string]$vpgName = "Test", [Parameter(Mandatory = $true)][Int32]$LimitValueInGB = 300, [Parameter(Mandatory = $true)][Int32]$ThresholdValueInGB = 250 ) #----------------------------------------------------------[Declarations]---------------------------------------------------------- # Build Base URL -> for all RestMethods $baseURL = "https://" + $zvm + ":443/v1/" # New Limit Value in MB $LimitValueInMB = $LimitValueInGB * 1024 # New Warning Threshold in MB $ThresholdValueInMB = $ThresholdValueInGB * 1024 # Responsetype $TypeJSON = "application/json" #-----------------------------------------------------------[Functions]------------------------------------------------------------ Function Get-ZertoSession ($ZertoUser, $ZertoPassword) { # Authenticating with Zerto APIs $xZertoSessionURL = $baseURL + "session/add" $authInfo = ("{0}:{1}" -f $ZertoUser, $ZertoPassword) $authInfo = [System.Text.Encoding]::UTF8.GetBytes($authInfo) $authInfo = [System.Convert]::ToBase64String($authInfo) $headers = @{Authorization = ("Basic {0}" -f $authInfo)} $sessionBody = '{"AuthenticationMethod": "1"}' # Get Zerto Session Response $xZertoSessionResponse = Invoke-WebRequest -Uri $xZertoSessionURL -Headers $headers -Method POST -Body $sessionBody -ContentType $TypeJSON # Extracting x-zerto-session from the response $xZertoSession = $xZertoSessionResponse.headers.get_item("x-zerto-session") # Return Zerto Session Header return @{"Accept" = "application/json"; "x-zerto-session" = $xZertoSession} } #-----------------------------------------------------------[Execution]------------------------------------------------------------ # Get Zerto Session $zertoSessionHeader = Get-ZertoSession -ZertoUser "virtualFrog" -ZertoPassword "Password" # Get VPG $vpgListUrl = $baseURL + "vpgs" $vpg = Invoke-RestMethod -Uri $vpgListUrl -Headers $zertoSessionHeader -ContentType $TypeJSON #Filter the one from the paramater $vpgToEdit = $vpg |Where-Object {$_.VpgName -eq "$vpgName"} Write-Host "Changing Journal Limit and Threshold Settings of: "($vpgToEdit.VpgName) #Get the identifier of this VPG $VPGidentifier = $vpgToEdit.VpgIdentifier $VPGidentifierJSON = '{"VpgIdentifier":"' + $VPGidentifier + '"}' #$VPGidentifier # Get VPG Settings Identifier $VPGSettingsIDURL = $baseURL + "vpgSettings" $VPGSettingsIdentifier = Invoke-RestMethod -Method Post -Uri $VPGSettingsIDURL -Body $VPGidentifierJSON -ContentType $TypeJSON -Headers $zertoSessionHeader # Set VPG Settings URL $VPGSettingsURL = $baseURL + "vpgSettings/" + $VPGSettingsIdentifier $VPGSettingsBasicURL = $VPGSettingsURL + "/basic" $VPGSettingsJournalURL = $VPGSettingsURL + "/journal" $VPGSettingsCommitURL = $VPGSettingsURL + "/commit" $VPGSettingsVMsJournalURL = $VPGSettingsURL + "/vms" # Get the actual VPG Settings $VPGSettings = Invoke-RestMethod -Uri $VPGSettingsURL -Headers $zertoSessionHeader -ContentType $TypeJSON $HardLimitGB = $VPGSettings.Journal.Limitation.HardLimitInMB / 1024 $WarningThresholdGB = $VPGSettings.Journal.Limitation.WarningThresholdInMB / 1024 #Write-Host "Hard Limit of this VPG in GB: " $HardLimitGB #Write-Host "Warning Threshold of this VPG in GB: " $WarningThresholdGB #Change Setting of VPG $VPGSettings.Journal.Limitation.HardLimitInMB = $LimitValueInMB $VPGSettings.Journal.Limitation.WarningThresholdInMB = $ThresholdValueInMB $data = @{Limitation = @{ HardLimitInMB = $LimitValueInMB WarningThresholdInMB = $ThresholdValueInMB } } $json = $data | ConvertTo-Json $vmdata = @{Journal = @{ Limitation = @{ HardLimitInMB = $LimitValueInMB WarningThresholdInMB = $ThresholdValueInMB } } } $vmjson = $vmdata |ConvertTo-Json #Write Change to Zerto $ChangedVPG = Invoke-RestMethod -Uri $VPGSettingsJournalURL -Method Put -Body $json -Headers $zertoSessionHeader -ContentType $TypeJSON foreach ($vm in $VPGSettings.VMs) { $vmIdentifier = $vm.VmIdentifier $VPGSettingsVMsJournalURL = $VPGSettingsURL + "/vms/" + $vmIdentifier $VMHardLimitGB = $vm.Journal.Limitation.HardLimitInMB / 1024 $VMWarningThreshold = $vm.Journal.Limitation.WarningThresholdInMB / 1024 #Write-Host "VM ("$vm.VmIdentifier") has Limit of "$VMHardLimitGB " GB and Warning of " $VMWarningThreshold "GB" $ChangedVPG = Invoke-RestMethod -Uri $VPGSettingsVMsJournalURL -Method Put -Body $vmjson -Headers $zertoSessionHeader -ContentType $TypeJSON } $VPGCommit = Invoke-RestMethod -Method Post -Uri $VPGSettingsCommitURL -ContentType $TypeJSON -Headers $zertoSessionHeader Write-Host -ForegroundColor Green "Changed the valued successfully!" ```status: corpus: 315 alsoLike: - {ref: posts/how-to-disaster-recovery-mit-vmware-live-cyber-recovery, score: 1.00} - {ref: posts/changing-default-backup-location-for-mssql-database, score: 1.00} - {ref: solutions/vmware/vmware-cloud-foundation/addon/site-recovery-manager, score: 0.72} search: /en/search.json
{ "apiVersion": "soultec.ch/v1", "kind": "Post", "metadata": { "name": "zerto-automating-vpg-journal-limit-changes", "locale": "en", "labels": { "author": "dario-doerflinger", "capability/backup-recovery": 2.14, "vendor/vmware": 0.98 }, "annotations": { "source": "blog-content/posts/en/zerto-automating-vpg-journal-limit-changes.md", "route": "/en/insights/zerto-automating-vpg-journal-limit-changes/", "schema": "/nerd/schema/posts.json", "markdown": "/en/insights/zerto-automating-vpg-journal-limit-changes.md" } }, "spec": { "title": "Automating VPG journal limit changes", "date": "2018-06-06", "author": "dario-doerflinger", "locale": "en", "summary": "I helped one of our customers implement Zerto in their environment.", "capabilities": [ "backup-recovery" ], "vendors": [ "vmware" ], "legacySlug": "zerto-automating-vpg-journal-limit-changes", "migrated": "2026-08-24", "draft": false, "sections": [ { "body": "I helped one of our customers implement Zerto in their environment. When you deploy Zerto and start protecting your VMs with it you need to know which applications you want to group together into virtual protection groups (VPGs). Another thing you'd define beforehand would be how many days you would want to be able to go back in time with Zerto and use that as a base to define the journal size limit of your VPGs.\n\nNow, some VMs produce a lot of I/Os while other are basically silent. This is key in how much space they are going to use and need in their VPG. So while for most of your VPGs the intially defined limit will be sufficient to reach your desired amount of time to go back it will not nearly be enough for your most I/O intensive workloads.\n\nWhen you then go ahead and change the journal limit on this VPG it will NOT update this setting on VMs that are already inside this VPG. When we first noticed this we thought this must be a bug and opened a case with Zerto. The support engineer then told us that this is not a bug but rather it's a feature… The customer and we had a different view on that so we started looking at the zerto API to remedy this unsatisfying situation.\n\nLong story short: Below is a script that will enable you to change the journal limit on a VPG and then iterate through all VMs in that VPG and set the same values (makes perfect sense in our use-case).\n\nUpdate: this script is now published at [GitHub](https://github.com/virtualFrog/PowerCLI-Scripts).\n\n```powershell\n\nparam(\n[Parameter(Mandatory = $true)][string]$zvm = \"zvm.virtualfrog.wordpress.com\",\n[Parameter(Mandatory = $true)][string]$vpgName = \"Test\",\n[Parameter(Mandatory = $true)][Int32]$LimitValueInGB = 300,\n[Parameter(Mandatory = $true)][Int32]$ThresholdValueInGB = 250\n)\n\n#----------------------------------------------------------[Declarations]----------------------------------------------------------\n\n# Build Base URL -> for all RestMethods\n$baseURL = \"https://\" + $zvm + \":443/v1/\"\n\n# New Limit Value in MB\n$LimitValueInMB = $LimitValueInGB * 1024\n\n# New Warning Threshold in MB\n$ThresholdValueInMB = $ThresholdValueInGB * 1024\n\n# Responsetype\n$TypeJSON = \"application/json\"\n\n#-----------------------------------------------------------[Functions]------------------------------------------------------------\n\nFunction Get-ZertoSession ($ZertoUser, $ZertoPassword) {\n# Authenticating with Zerto APIs\n$xZertoSessionURL = $baseURL + \"session/add\"\n$authInfo = (\"{0}:{1}\" -f $ZertoUser, $ZertoPassword)\n$authInfo = [System.Text.Encoding]::UTF8.GetBytes($authInfo)\n$authInfo = [System.Convert]::ToBase64String($authInfo)\n$headers = @{Authorization = (\"Basic {0}\" -f $authInfo)}\n$sessionBody = '{\"AuthenticationMethod\": \"1\"}'\n\n# Get Zerto Session Response\n$xZertoSessionResponse = Invoke-WebRequest -Uri $xZertoSessionURL -Headers $headers -Method POST -Body $sessionBody -ContentType $TypeJSON\n\n# Extracting x-zerto-session from the response\n$xZertoSession = $xZertoSessionResponse.headers.get_item(\"x-zerto-session\")\n\n# Return Zerto Session Header\nreturn @{\"Accept\" = \"application/json\"; \"x-zerto-session\" = $xZertoSession}\n}\n\n#-----------------------------------------------------------[Execution]------------------------------------------------------------\n\n# Get Zerto Session\n$zertoSessionHeader = Get-ZertoSession -ZertoUser \"virtualFrog\" -ZertoPassword \"Password\"\n\n# Get VPG\n$vpgListUrl = $baseURL + \"vpgs\"\n$vpg = Invoke-RestMethod -Uri $vpgListUrl -Headers $zertoSessionHeader -ContentType $TypeJSON\n\n#Filter the one from the paramater\n$vpgToEdit = $vpg |Where-Object {$_.VpgName -eq \"$vpgName\"}\nWrite-Host \"Changing Journal Limit and Threshold Settings of: \"($vpgToEdit.VpgName)\n\n#Get the identifier of this VPG\n$VPGidentifier = $vpgToEdit.VpgIdentifier\n$VPGidentifierJSON = '{\"VpgIdentifier\":\"' + $VPGidentifier + '\"}'\n#$VPGidentifier\n\n# Get VPG Settings Identifier\n$VPGSettingsIDURL = $baseURL + \"vpgSettings\"\n$VPGSettingsIdentifier = Invoke-RestMethod -Method Post -Uri $VPGSettingsIDURL -Body $VPGidentifierJSON -ContentType $TypeJSON -Headers $zertoSessionHeader\n\n# Set VPG Settings URL\n$VPGSettingsURL = $baseURL + \"vpgSettings/\" + $VPGSettingsIdentifier\n$VPGSettingsBasicURL = $VPGSettingsURL + \"/basic\"\n$VPGSettingsJournalURL = $VPGSettingsURL + \"/journal\"\n$VPGSettingsCommitURL = $VPGSettingsURL + \"/commit\"\n$VPGSettingsVMsJournalURL = $VPGSettingsURL + \"/vms\"\n\n# Get the actual VPG Settings\n$VPGSettings = Invoke-RestMethod -Uri $VPGSettingsURL -Headers $zertoSessionHeader -ContentType $TypeJSON\n\n$HardLimitGB = $VPGSettings.Journal.Limitation.HardLimitInMB / 1024\n$WarningThresholdGB = $VPGSettings.Journal.Limitation.WarningThresholdInMB / 1024\n#Write-Host \"Hard Limit of this VPG in GB: \" $HardLimitGB\n#Write-Host \"Warning Threshold of this VPG in GB: \" $WarningThresholdGB\n\n#Change Setting of VPG\n$VPGSettings.Journal.Limitation.HardLimitInMB = $LimitValueInMB\n$VPGSettings.Journal.Limitation.WarningThresholdInMB = $ThresholdValueInMB\n\n$data = @{Limitation = @{\nHardLimitInMB = $LimitValueInMB\nWarningThresholdInMB = $ThresholdValueInMB\n}\n}\n$json = $data | ConvertTo-Json\n\n$vmdata = @{Journal = @{\nLimitation = @{\nHardLimitInMB = $LimitValueInMB\nWarningThresholdInMB = $ThresholdValueInMB\n}\n}\n}\n$vmjson = $vmdata |ConvertTo-Json\n#Write Change to Zerto\n$ChangedVPG = Invoke-RestMethod -Uri $VPGSettingsJournalURL -Method Put -Body $json -Headers $zertoSessionHeader -ContentType $TypeJSON\n\nforeach ($vm in $VPGSettings.VMs) {\n$vmIdentifier = $vm.VmIdentifier\n$VPGSettingsVMsJournalURL = $VPGSettingsURL + \"/vms/\" + $vmIdentifier\n$VMHardLimitGB = $vm.Journal.Limitation.HardLimitInMB / 1024\n$VMWarningThreshold = $vm.Journal.Limitation.WarningThresholdInMB / 1024\n\n#Write-Host \"VM (\"$vm.VmIdentifier\") has Limit of \"$VMHardLimitGB \" GB and Warning of \" $VMWarningThreshold \"GB\"\n$ChangedVPG = Invoke-RestMethod -Uri $VPGSettingsVMsJournalURL -Method Put -Body $vmjson -Headers $zertoSessionHeader -ContentType $TypeJSON\n\n}\n\n$VPGCommit = Invoke-RestMethod -Method Post -Uri $VPGSettingsCommitURL -ContentType $TypeJSON -Headers $zertoSessionHeader\nWrite-Host -ForegroundColor Green \"Changed the valued successfully!\"\n```" } ] }, "status": { "corpus": 315, "alsoLike": [ { "ref": "posts/how-to-disaster-recovery-mit-vmware-live-cyber-recovery", "score": "1.00" }, { "ref": "posts/changing-default-backup-location-for-mssql-database", "score": "1.00" }, { "ref": "solutions/vmware/vmware-cloud-foundation/addon/site-recovery-manager", "score": "0.72" } ], "search": "/en/search.json" }}
apiVersion = "soultec.ch/v1"kind = "Post"[metadata]name = "zerto-automating-vpg-journal-limit-changes"locale = "en"[metadata.labels]author = "dario-doerflinger""capability/backup-recovery" = 2.14"vendor/vmware" = 0.98[metadata.annotations]source = "blog-content/posts/en/zerto-automating-vpg-journal-limit-changes.md"route = "/en/insights/zerto-automating-vpg-journal-limit-changes/"schema = "/nerd/schema/posts.json"markdown = "/en/insights/zerto-automating-vpg-journal-limit-changes.md"[spec]title = "Automating VPG journal limit changes"date = 2018-06-06author = "dario-doerflinger"locale = "en"summary = "I helped one of our customers implement Zerto in their environment."capabilities = ["backup-recovery"]vendors = ["vmware"]legacySlug = "zerto-automating-vpg-journal-limit-changes"migrated = 2026-08-24draft = false[[spec.sections]]body = '''I helped one of our customers implement Zerto in their environment. When you deploy Zerto and start protecting your VMs with it you need to know which applications you want to group together into virtual protection groups (VPGs). Another thing you'd define beforehand would be how many days you would want to be able to go back in time with Zerto and use that as a base to define the journal size limit of your VPGs.Now, some VMs produce a lot of I/Os while other are basically silent. This is key in how much space they are going to use and need in their VPG. So while for most of your VPGs the intially defined limit will be sufficient to reach your desired amount of time to go back it will not nearly be enough for your most I/O intensive workloads.When you then go ahead and change the journal limit on this VPG it will NOT update this setting on VMs that are already inside this VPG. When we first noticed this we thought this must be a bug and opened a case with Zerto. The support engineer then told us that this is not a bug but rather it's a feature… The customer and we had a different view on that so we started looking at the zerto API to remedy this unsatisfying situation.Long story short: Below is a script that will enable you to change the journal limit on a VPG and then iterate through all VMs in that VPG and set the same values (makes perfect sense in our use-case).Update: this script is now published at [GitHub](https://github.com/virtualFrog/PowerCLI-Scripts).```powershellparam([Parameter(Mandatory = $true)][string]$zvm = "zvm.virtualfrog.wordpress.com",[Parameter(Mandatory = $true)][string]$vpgName = "Test",[Parameter(Mandatory = $true)][Int32]$LimitValueInGB = 300,[Parameter(Mandatory = $true)][Int32]$ThresholdValueInGB = 250)#----------------------------------------------------------[Declarations]----------------------------------------------------------# Build Base URL -> for all RestMethods$baseURL = "https://" + $zvm + ":443/v1/"# New Limit Value in MB$LimitValueInMB = $LimitValueInGB * 1024# New Warning Threshold in MB$ThresholdValueInMB = $ThresholdValueInGB * 1024# Responsetype$TypeJSON = "application/json"#-----------------------------------------------------------[Functions]------------------------------------------------------------Function Get-ZertoSession ($ZertoUser, $ZertoPassword) {# Authenticating with Zerto APIs$xZertoSessionURL = $baseURL + "session/add"$authInfo = ("{0}:{1}" -f $ZertoUser, $ZertoPassword)$authInfo = [System.Text.Encoding]::UTF8.GetBytes($authInfo)$authInfo = [System.Convert]::ToBase64String($authInfo)$headers = @{Authorization = ("Basic {0}" -f $authInfo)}$sessionBody = '{"AuthenticationMethod": "1"}'# Get Zerto Session Response$xZertoSessionResponse = Invoke-WebRequest -Uri $xZertoSessionURL -Headers $headers -Method POST -Body $sessionBody -ContentType $TypeJSON# Extracting x-zerto-session from the response$xZertoSession = $xZertoSessionResponse.headers.get_item("x-zerto-session")# Return Zerto Session Headerreturn @{"Accept" = "application/json"; "x-zerto-session" = $xZertoSession}}#-----------------------------------------------------------[Execution]------------------------------------------------------------# Get Zerto Session$zertoSessionHeader = Get-ZertoSession -ZertoUser "virtualFrog" -ZertoPassword "Password"# Get VPG$vpgListUrl = $baseURL + "vpgs"$vpg = Invoke-RestMethod -Uri $vpgListUrl -Headers $zertoSessionHeader -ContentType $TypeJSON#Filter the one from the paramater$vpgToEdit = $vpg |Where-Object {$_.VpgName -eq "$vpgName"}Write-Host "Changing Journal Limit and Threshold Settings of: "($vpgToEdit.VpgName)#Get the identifier of this VPG$VPGidentifier = $vpgToEdit.VpgIdentifier$VPGidentifierJSON = '{"VpgIdentifier":"' + $VPGidentifier + '"}'#$VPGidentifier# Get VPG Settings Identifier$VPGSettingsIDURL = $baseURL + "vpgSettings"$VPGSettingsIdentifier = Invoke-RestMethod -Method Post -Uri $VPGSettingsIDURL -Body $VPGidentifierJSON -ContentType $TypeJSON -Headers $zertoSessionHeader# Set VPG Settings URL$VPGSettingsURL = $baseURL + "vpgSettings/" + $VPGSettingsIdentifier$VPGSettingsBasicURL = $VPGSettingsURL + "/basic"$VPGSettingsJournalURL = $VPGSettingsURL + "/journal"$VPGSettingsCommitURL = $VPGSettingsURL + "/commit"$VPGSettingsVMsJournalURL = $VPGSettingsURL + "/vms"# Get the actual VPG Settings$VPGSettings = Invoke-RestMethod -Uri $VPGSettingsURL -Headers $zertoSessionHeader -ContentType $TypeJSON$HardLimitGB = $VPGSettings.Journal.Limitation.HardLimitInMB / 1024$WarningThresholdGB = $VPGSettings.Journal.Limitation.WarningThresholdInMB / 1024#Write-Host "Hard Limit of this VPG in GB: " $HardLimitGB#Write-Host "Warning Threshold of this VPG in GB: " $WarningThresholdGB#Change Setting of VPG$VPGSettings.Journal.Limitation.HardLimitInMB = $LimitValueInMB$VPGSettings.Journal.Limitation.WarningThresholdInMB = $ThresholdValueInMB$data = @{Limitation = @{HardLimitInMB = $LimitValueInMBWarningThresholdInMB = $ThresholdValueInMB}}$json = $data | ConvertTo-Json$vmdata = @{Journal = @{Limitation = @{HardLimitInMB = $LimitValueInMBWarningThresholdInMB = $ThresholdValueInMB}}}$vmjson = $vmdata |ConvertTo-Json#Write Change to Zerto$ChangedVPG = Invoke-RestMethod -Uri $VPGSettingsJournalURL -Method Put -Body $json -Headers $zertoSessionHeader -ContentType $TypeJSONforeach ($vm in $VPGSettings.VMs) {$vmIdentifier = $vm.VmIdentifier$VPGSettingsVMsJournalURL = $VPGSettingsURL + "/vms/" + $vmIdentifier$VMHardLimitGB = $vm.Journal.Limitation.HardLimitInMB / 1024$VMWarningThreshold = $vm.Journal.Limitation.WarningThresholdInMB / 1024#Write-Host "VM ("$vm.VmIdentifier") has Limit of "$VMHardLimitGB " GB and Warning of " $VMWarningThreshold "GB"$ChangedVPG = Invoke-RestMethod -Uri $VPGSettingsVMsJournalURL -Method Put -Body $vmjson -Headers $zertoSessionHeader -ContentType $TypeJSON}$VPGCommit = Invoke-RestMethod -Method Post -Uri $VPGSettingsCommitURL -ContentType $TypeJSON -Headers $zertoSessionHeaderWrite-Host -ForegroundColor Green "Changed the valued successfully!"```'''[status]corpus = 315search = "/en/search.json"[[status.alsoLike]]ref = "posts/how-to-disaster-recovery-mit-vmware-live-cyber-recovery"score = "1.00"[[status.alsoLike]]ref = "posts/changing-default-backup-location-for-mssql-database"score = "1.00"[[status.alsoLike]]ref = "solutions/vmware/vmware-cloud-foundation/addon/site-recovery-manager"score = "0.72"
<?xml version="1.0" encoding="UTF-8"?><manifest kind="Post"> <apiVersion>soultec.ch/v1</apiVersion> <metadata> <name>zerto-automating-vpg-journal-limit-changes</name> <locale>en</locale> <labels> <author>dario-doerflinger</author> <entry key="capability/backup-recovery">2.14</entry> <entry key="vendor/vmware">0.98</entry> </labels> <annotations> <source>blog-content/posts/en/zerto-automating-vpg-journal-limit-changes.md</source> <route>/en/insights/zerto-automating-vpg-journal-limit-changes/</route> <schema>/nerd/schema/posts.json</schema> <markdown>/en/insights/zerto-automating-vpg-journal-limit-changes.md</markdown> </annotations> </metadata> <spec> <title>Automating VPG journal limit changes</title> <date>2018-06-06</date> <author>dario-doerflinger</author> <locale>en</locale> <summary>I helped one of our customers implement Zerto in their environment.</summary> <capabilities> <item>backup-recovery</item> </capabilities> <vendors> <item>vmware</item> </vendors> <legacySlug>zerto-automating-vpg-journal-limit-changes</legacySlug> <migrated>2026-08-24</migrated> <draft>false</draft> <sections> <section> <body>I helped one of our customers implement Zerto in their environment. When you deploy Zerto and start protecting your VMs with it you need to know which applications you want to group together into virtual protection groups (VPGs). Another thing you'd define beforehand would be how many days you would want to be able to go back in time with Zerto and use that as a base to define the journal size limit of your VPGs.Now, some VMs produce a lot of I/Os while other are basically silent. This is key in how much space they are going to use and need in their VPG. So while for most of your VPGs the intially defined limit will be sufficient to reach your desired amount of time to go back it will not nearly be enough for your most I/O intensive workloads.When you then go ahead and change the journal limit on this VPG it will NOT update this setting on VMs that are already inside this VPG. When we first noticed this we thought this must be a bug and opened a case with Zerto. The support engineer then told us that this is not a bug but rather it's a feature… The customer and we had a different view on that so we started looking at the zerto API to remedy this unsatisfying situation.Long story short: Below is a script that will enable you to change the journal limit on a VPG and then iterate through all VMs in that VPG and set the same values (makes perfect sense in our use-case).Update: this script is now published at [GitHub](https://github.com/virtualFrog/PowerCLI-Scripts).```powershellparam([Parameter(Mandatory = $true)][string]$zvm = "zvm.virtualfrog.wordpress.com",[Parameter(Mandatory = $true)][string]$vpgName = "Test",[Parameter(Mandatory = $true)][Int32]$LimitValueInGB = 300,[Parameter(Mandatory = $true)][Int32]$ThresholdValueInGB = 250)#----------------------------------------------------------[Declarations]----------------------------------------------------------# Build Base URL -&gt; for all RestMethods$baseURL = "https://" + $zvm + ":443/v1/"# New Limit Value in MB$LimitValueInMB = $LimitValueInGB * 1024# New Warning Threshold in MB$ThresholdValueInMB = $ThresholdValueInGB * 1024# Responsetype$TypeJSON = "application/json"#-----------------------------------------------------------[Functions]------------------------------------------------------------Function Get-ZertoSession ($ZertoUser, $ZertoPassword) {# Authenticating with Zerto APIs$xZertoSessionURL = $baseURL + "session/add"$authInfo = ("{0}:{1}" -f $ZertoUser, $ZertoPassword)$authInfo = [System.Text.Encoding]::UTF8.GetBytes($authInfo)$authInfo = [System.Convert]::ToBase64String($authInfo)$headers = @{Authorization = ("Basic {0}" -f $authInfo)}$sessionBody = '{"AuthenticationMethod": "1"}'# Get Zerto Session Response$xZertoSessionResponse = Invoke-WebRequest -Uri $xZertoSessionURL -Headers $headers -Method POST -Body $sessionBody -ContentType $TypeJSON# Extracting x-zerto-session from the response$xZertoSession = $xZertoSessionResponse.headers.get_item("x-zerto-session")# Return Zerto Session Headerreturn @{"Accept" = "application/json"; "x-zerto-session" = $xZertoSession}}#-----------------------------------------------------------[Execution]------------------------------------------------------------# Get Zerto Session$zertoSessionHeader = Get-ZertoSession -ZertoUser "virtualFrog" -ZertoPassword "Password"# Get VPG$vpgListUrl = $baseURL + "vpgs"$vpg = Invoke-RestMethod -Uri $vpgListUrl -Headers $zertoSessionHeader -ContentType $TypeJSON#Filter the one from the paramater$vpgToEdit = $vpg |Where-Object {$_.VpgName -eq "$vpgName"}Write-Host "Changing Journal Limit and Threshold Settings of: "($vpgToEdit.VpgName)#Get the identifier of this VPG$VPGidentifier = $vpgToEdit.VpgIdentifier$VPGidentifierJSON = '{"VpgIdentifier":"' + $VPGidentifier + '"}'#$VPGidentifier# Get VPG Settings Identifier$VPGSettingsIDURL = $baseURL + "vpgSettings"$VPGSettingsIdentifier = Invoke-RestMethod -Method Post -Uri $VPGSettingsIDURL -Body $VPGidentifierJSON -ContentType $TypeJSON -Headers $zertoSessionHeader# Set VPG Settings URL$VPGSettingsURL = $baseURL + "vpgSettings/" + $VPGSettingsIdentifier$VPGSettingsBasicURL = $VPGSettingsURL + "/basic"$VPGSettingsJournalURL = $VPGSettingsURL + "/journal"$VPGSettingsCommitURL = $VPGSettingsURL + "/commit"$VPGSettingsVMsJournalURL = $VPGSettingsURL + "/vms"# Get the actual VPG Settings$VPGSettings = Invoke-RestMethod -Uri $VPGSettingsURL -Headers $zertoSessionHeader -ContentType $TypeJSON$HardLimitGB = $VPGSettings.Journal.Limitation.HardLimitInMB / 1024$WarningThresholdGB = $VPGSettings.Journal.Limitation.WarningThresholdInMB / 1024#Write-Host "Hard Limit of this VPG in GB: " $HardLimitGB#Write-Host "Warning Threshold of this VPG in GB: " $WarningThresholdGB#Change Setting of VPG$VPGSettings.Journal.Limitation.HardLimitInMB = $LimitValueInMB$VPGSettings.Journal.Limitation.WarningThresholdInMB = $ThresholdValueInMB$data = @{Limitation = @{HardLimitInMB = $LimitValueInMBWarningThresholdInMB = $ThresholdValueInMB}}$json = $data | ConvertTo-Json$vmdata = @{Journal = @{Limitation = @{HardLimitInMB = $LimitValueInMBWarningThresholdInMB = $ThresholdValueInMB}}}$vmjson = $vmdata |ConvertTo-Json#Write Change to Zerto$ChangedVPG = Invoke-RestMethod -Uri $VPGSettingsJournalURL -Method Put -Body $json -Headers $zertoSessionHeader -ContentType $TypeJSONforeach ($vm in $VPGSettings.VMs) {$vmIdentifier = $vm.VmIdentifier$VPGSettingsVMsJournalURL = $VPGSettingsURL + "/vms/" + $vmIdentifier$VMHardLimitGB = $vm.Journal.Limitation.HardLimitInMB / 1024$VMWarningThreshold = $vm.Journal.Limitation.WarningThresholdInMB / 1024#Write-Host "VM ("$vm.VmIdentifier") has Limit of "$VMHardLimitGB " GB and Warning of " $VMWarningThreshold "GB"$ChangedVPG = Invoke-RestMethod -Uri $VPGSettingsVMsJournalURL -Method Put -Body $vmjson -Headers $zertoSessionHeader -ContentType $TypeJSON}$VPGCommit = Invoke-RestMethod -Method Post -Uri $VPGSettingsCommitURL -ContentType $TypeJSON -Headers $zertoSessionHeaderWrite-Host -ForegroundColor Green "Changed the valued successfully!"``` </body> </section> </sections> </spec> <status> <corpus>315</corpus> <alsoLike> <item> <ref>posts/how-to-disaster-recovery-mit-vmware-live-cyber-recovery</ref> <score>1.00</score> </item> <item> <ref>posts/changing-default-backup-location-for-mssql-database</ref> <score>1.00</score> </item> <item> <ref>solutions/vmware/vmware-cloud-foundation/addon/site-recovery-manager</ref> <score>0.72</score> </item> </alsoLike> <search>/en/search.json</search> </status></manifest>
# Code generated by the soultec.ch build. DO NOT EDIT.import jsonPAGE = { "apiVersion": "soultec.ch/v1", "kind": "Post", "metadata": { "name": "zerto-automating-vpg-journal-limit-changes", "locale": "en", "labels": { "author": "dario-doerflinger", "capability/backup-recovery": 2.14, "vendor/vmware": 0.98, }, "annotations": { "source": "blog-content/posts/en/zerto-automating-vpg-journal-limit-changes.md", "route": "/en/insights/zerto-automating-vpg-journal-limit-changes/", "schema": "/nerd/schema/posts.json", "markdown": "/en/insights/zerto-automating-vpg-journal-limit-changes.md", }, }, "spec": { "title": "Automating VPG journal limit changes", "date": "2018-06-06", "author": "dario-doerflinger", "locale": "en", "summary": "I helped one of our customers implement Zerto in their environment.", "capabilities": ["backup-recovery"], "vendors": ["vmware"], "legacySlug": "zerto-automating-vpg-journal-limit-changes", "migrated": "2026-08-24", "draft": False, "sections": [ { "body": ( "I helped one of our customers implement Zerto in their environment. When you deploy Zerto and start protecting your VMs with it you need to know which applications you want to group together into virtual protection groups (VPGs). Another thing you'd define beforehand would be how many days you would want to be able to go back in time with Zerto and use that as a base to define the journal size limit of your VPGs.\n" "\n" "Now, some VMs produce a lot of I/Os while other are basically silent. This is key in how much space they are going to use and need in their VPG. So while for most of your VPGs the intially defined limit will be sufficient to reach your desired amount of time to go back it will not nearly be enough for your most I/O intensive workloads.\n" "\n" "When you then go ahead and change the journal limit on this VPG it will NOT update this setting on VMs that are already inside this VPG. When we first noticed this we thought this must be a bug and opened a case with Zerto. The support engineer then told us that this is not a bug but rather it's a feature… The customer and we had a different view on that so we started looking at the zerto API to remedy this unsatisfying situation.\n" "\n" "Long story short: Below is a script that will enable you to change the journal limit on a VPG and then iterate through all VMs in that VPG and set the same values (makes perfect sense in our use-case).\n" "\n" "Update: this script is now published at [GitHub](https://github.com/virtualFrog/PowerCLI-Scripts).\n" "\n" "```powershell\n" "\n" "param(\n" "[Parameter(Mandatory = $true)][string]$zvm = \"zvm.virtualfrog.wordpress.com\",\n" "[Parameter(Mandatory = $true)][string]$vpgName = \"Test\",\n" "[Parameter(Mandatory = $true)][Int32]$LimitValueInGB = 300,\n" "[Parameter(Mandatory = $true)][Int32]$ThresholdValueInGB = 250\n" ")\n" "\n" "#----------------------------------------------------------[Declarations]----------------------------------------------------------\n" "\n" "# Build Base URL -> for all RestMethods\n" "$baseURL = \"https://\" + $zvm + \":443/v1/\"\n" "\n" "# New Limit Value in MB\n" "$LimitValueInMB = $LimitValueInGB * 1024\n" "\n" "# New Warning Threshold in MB\n" "$ThresholdValueInMB = $ThresholdValueInGB * 1024\n" "\n" "# Responsetype\n" "$TypeJSON = \"application/json\"\n" "\n" "#-----------------------------------------------------------[Functions]------------------------------------------------------------\n" "\n" "Function Get-ZertoSession ($ZertoUser, $ZertoPassword) {\n" "# Authenticating with Zerto APIs\n" "$xZertoSessionURL = $baseURL + \"session/add\"\n" "$authInfo = (\"{0}:{1}\" -f $ZertoUser, $ZertoPassword)\n" "$authInfo = [System.Text.Encoding]::UTF8.GetBytes($authInfo)\n" "$authInfo = [System.Convert]::ToBase64String($authInfo)\n" "$headers = @{Authorization = (\"Basic {0}\" -f $authInfo)}\n" "$sessionBody = '{\"AuthenticationMethod\": \"1\"}'\n" "\n" "# Get Zerto Session Response\n" "$xZertoSessionResponse = Invoke-WebRequest -Uri $xZertoSessionURL -Headers $headers -Method POST -Body $sessionBody -ContentType $TypeJSON\n" "\n" "# Extracting x-zerto-session from the response\n" "$xZertoSession = $xZertoSessionResponse.headers.get_item(\"x-zerto-session\")\n" "\n" "# Return Zerto Session Header\n" "return @{\"Accept\" = \"application/json\"; \"x-zerto-session\" = $xZertoSession}\n" "}\n" "\n" "#-----------------------------------------------------------[Execution]------------------------------------------------------------\n" "\n" "# Get Zerto Session\n" "$zertoSessionHeader = Get-ZertoSession -ZertoUser \"virtualFrog\" -ZertoPassword \"Password\"\n" "\n" "# Get VPG\n" "$vpgListUrl = $baseURL + \"vpgs\"\n" "$vpg = Invoke-RestMethod -Uri $vpgListUrl -Headers $zertoSessionHeader -ContentType $TypeJSON\n" "\n" "#Filter the one from the paramater\n" "$vpgToEdit = $vpg |Where-Object {$_.VpgName -eq \"$vpgName\"}\n" "Write-Host \"Changing Journal Limit and Threshold Settings of: \"($vpgToEdit.VpgName)\n" "\n" "#Get the identifier of this VPG\n" "$VPGidentifier = $vpgToEdit.VpgIdentifier\n" "$VPGidentifierJSON = '{\"VpgIdentifier\":\"' + $VPGidentifier + '\"}'\n" "#$VPGidentifier\n" "\n" "# Get VPG Settings Identifier\n" "$VPGSettingsIDURL = $baseURL + \"vpgSettings\"\n" "$VPGSettingsIdentifier = Invoke-RestMethod -Method Post -Uri $VPGSettingsIDURL -Body $VPGidentifierJSON -ContentType $TypeJSON -Headers $zertoSessionHeader\n" "\n" "# Set VPG Settings URL\n" "$VPGSettingsURL = $baseURL + \"vpgSettings/\" + $VPGSettingsIdentifier\n" "$VPGSettingsBasicURL = $VPGSettingsURL + \"/basic\"\n" "$VPGSettingsJournalURL = $VPGSettingsURL + \"/journal\"\n" "$VPGSettingsCommitURL = $VPGSettingsURL + \"/commit\"\n" "$VPGSettingsVMsJournalURL = $VPGSettingsURL + \"/vms\"\n" "\n" "# Get the actual VPG Settings\n" "$VPGSettings = Invoke-RestMethod -Uri $VPGSettingsURL -Headers $zertoSessionHeader -ContentType $TypeJSON\n" "\n" "$HardLimitGB = $VPGSettings.Journal.Limitation.HardLimitInMB / 1024\n" "$WarningThresholdGB = $VPGSettings.Journal.Limitation.WarningThresholdInMB / 1024\n" "#Write-Host \"Hard Limit of this VPG in GB: \" $HardLimitGB\n" "#Write-Host \"Warning Threshold of this VPG in GB: \" $WarningThresholdGB\n" "\n" "#Change Setting of VPG\n" "$VPGSettings.Journal.Limitation.HardLimitInMB = $LimitValueInMB\n" "$VPGSettings.Journal.Limitation.WarningThresholdInMB = $ThresholdValueInMB\n" "\n" "$data = @{Limitation = @{\n" "HardLimitInMB = $LimitValueInMB\n" "WarningThresholdInMB = $ThresholdValueInMB\n" "}\n" "}\n" "$json = $data | ConvertTo-Json\n" "\n" "$vmdata = @{Journal = @{\n" "Limitation = @{\n" "HardLimitInMB = $LimitValueInMB\n" "WarningThresholdInMB = $ThresholdValueInMB\n" "}\n" "}\n" "}\n" "$vmjson = $vmdata |ConvertTo-Json\n" "#Write Change to Zerto\n" "$ChangedVPG = Invoke-RestMethod -Uri $VPGSettingsJournalURL -Method Put -Body $json -Headers $zertoSessionHeader -ContentType $TypeJSON\n" "\n" "foreach ($vm in $VPGSettings.VMs) {\n" "$vmIdentifier = $vm.VmIdentifier\n" "$VPGSettingsVMsJournalURL = $VPGSettingsURL + \"/vms/\" + $vmIdentifier\n" "$VMHardLimitGB = $vm.Journal.Limitation.HardLimitInMB / 1024\n" "$VMWarningThreshold = $vm.Journal.Limitation.WarningThresholdInMB / 1024\n" "\n" "#Write-Host \"VM (\"$vm.VmIdentifier\") has Limit of \"$VMHardLimitGB \" GB and Warning of \" $VMWarningThreshold \"GB\"\n" "$ChangedVPG = Invoke-RestMethod -Uri $VPGSettingsVMsJournalURL -Method Put -Body $vmjson -Headers $zertoSessionHeader -ContentType $TypeJSON\n" "\n" "}\n" "\n" "$VPGCommit = Invoke-RestMethod -Method Post -Uri $VPGSettingsCommitURL -ContentType $TypeJSON -Headers $zertoSessionHeader\n" "Write-Host -ForegroundColor Green \"Changed the valued successfully!\"\n" "```" ), }, ], }, "status": { "corpus": 315, "alsoLike": [ { "ref": "posts/how-to-disaster-recovery-mit-vmware-live-cyber-recovery", "score": "1.00", }, { "ref": "posts/changing-default-backup-location-for-mssql-database", "score": "1.00", }, { "ref": "solutions/vmware/vmware-cloud-foundation/addon/site-recovery-manager", "score": "0.72", }, ], "search": "/en/search.json", },}if __name__ == "__main__": print(json.dumps(PAGE, indent=2, ensure_ascii=False))
# Code generated by the soultec.ch build. DO NOT EDIT.$Page = [ordered]@{ apiVersion = 'soultec.ch/v1' kind = 'Post' metadata = [ordered]@{ name = 'zerto-automating-vpg-journal-limit-changes' locale = 'en' labels = [ordered]@{ author = 'dario-doerflinger' 'capability/backup-recovery' = 2.14 'vendor/vmware' = 0.98 } annotations = [ordered]@{ source = 'blog-content/posts/en/zerto-automating-vpg-journal-limit-changes.md' route = '/en/insights/zerto-automating-vpg-journal-limit-changes/' schema = '/nerd/schema/posts.json' markdown = '/en/insights/zerto-automating-vpg-journal-limit-changes.md' } } spec = [ordered]@{ title = 'Automating VPG journal limit changes' date = '2018-06-06' author = 'dario-doerflinger' locale = 'en' summary = 'I helped one of our customers implement Zerto in their environment.' capabilities = @('backup-recovery') vendors = @('vmware') legacySlug = 'zerto-automating-vpg-journal-limit-changes' migrated = '2026-08-24' draft = $false sections = @( [ordered]@{ body = @'I helped one of our customers implement Zerto in their environment. When you deploy Zerto and start protecting your VMs with it you need to know which applications you want to group together into virtual protection groups (VPGs). Another thing you'd define beforehand would be how many days you would want to be able to go back in time with Zerto and use that as a base to define the journal size limit of your VPGs.Now, some VMs produce a lot of I/Os while other are basically silent. This is key in how much space they are going to use and need in their VPG. So while for most of your VPGs the intially defined limit will be sufficient to reach your desired amount of time to go back it will not nearly be enough for your most I/O intensive workloads.When you then go ahead and change the journal limit on this VPG it will NOT update this setting on VMs that are already inside this VPG. When we first noticed this we thought this must be a bug and opened a case with Zerto. The support engineer then told us that this is not a bug but rather it's a feature… The customer and we had a different view on that so we started looking at the zerto API to remedy this unsatisfying situation.Long story short: Below is a script that will enable you to change the journal limit on a VPG and then iterate through all VMs in that VPG and set the same values (makes perfect sense in our use-case).Update: this script is now published at [GitHub](https://github.com/virtualFrog/PowerCLI-Scripts).```powershellparam([Parameter(Mandatory = $true)][string]$zvm = "zvm.virtualfrog.wordpress.com",[Parameter(Mandatory = $true)][string]$vpgName = "Test",[Parameter(Mandatory = $true)][Int32]$LimitValueInGB = 300,[Parameter(Mandatory = $true)][Int32]$ThresholdValueInGB = 250)#----------------------------------------------------------[Declarations]----------------------------------------------------------# Build Base URL -> for all RestMethods$baseURL = "https://" + $zvm + ":443/v1/"# New Limit Value in MB$LimitValueInMB = $LimitValueInGB * 1024# New Warning Threshold in MB$ThresholdValueInMB = $ThresholdValueInGB * 1024# Responsetype$TypeJSON = "application/json"#-----------------------------------------------------------[Functions]------------------------------------------------------------Function Get-ZertoSession ($ZertoUser, $ZertoPassword) {# Authenticating with Zerto APIs$xZertoSessionURL = $baseURL + "session/add"$authInfo = ("{0}:{1}" -f $ZertoUser, $ZertoPassword)$authInfo = [System.Text.Encoding]::UTF8.GetBytes($authInfo)$authInfo = [System.Convert]::ToBase64String($authInfo)$headers = @{Authorization = ("Basic {0}" -f $authInfo)}$sessionBody = '{"AuthenticationMethod": "1"}'# Get Zerto Session Response$xZertoSessionResponse = Invoke-WebRequest -Uri $xZertoSessionURL -Headers $headers -Method POST -Body $sessionBody -ContentType $TypeJSON# Extracting x-zerto-session from the response$xZertoSession = $xZertoSessionResponse.headers.get_item("x-zerto-session")# Return Zerto Session Headerreturn @{"Accept" = "application/json"; "x-zerto-session" = $xZertoSession}}#-----------------------------------------------------------[Execution]------------------------------------------------------------# Get Zerto Session$zertoSessionHeader = Get-ZertoSession -ZertoUser "virtualFrog" -ZertoPassword "Password"# Get VPG$vpgListUrl = $baseURL + "vpgs"$vpg = Invoke-RestMethod -Uri $vpgListUrl -Headers $zertoSessionHeader -ContentType $TypeJSON#Filter the one from the paramater$vpgToEdit = $vpg |Where-Object {$_.VpgName -eq "$vpgName"}Write-Host "Changing Journal Limit and Threshold Settings of: "($vpgToEdit.VpgName)#Get the identifier of this VPG$VPGidentifier = $vpgToEdit.VpgIdentifier$VPGidentifierJSON = '{"VpgIdentifier":"' + $VPGidentifier + '"}'#$VPGidentifier# Get VPG Settings Identifier$VPGSettingsIDURL = $baseURL + "vpgSettings"$VPGSettingsIdentifier = Invoke-RestMethod -Method Post -Uri $VPGSettingsIDURL -Body $VPGidentifierJSON -ContentType $TypeJSON -Headers $zertoSessionHeader# Set VPG Settings URL$VPGSettingsURL = $baseURL + "vpgSettings/" + $VPGSettingsIdentifier$VPGSettingsBasicURL = $VPGSettingsURL + "/basic"$VPGSettingsJournalURL = $VPGSettingsURL + "/journal"$VPGSettingsCommitURL = $VPGSettingsURL + "/commit"$VPGSettingsVMsJournalURL = $VPGSettingsURL + "/vms"# Get the actual VPG Settings$VPGSettings = Invoke-RestMethod -Uri $VPGSettingsURL -Headers $zertoSessionHeader -ContentType $TypeJSON$HardLimitGB = $VPGSettings.Journal.Limitation.HardLimitInMB / 1024$WarningThresholdGB = $VPGSettings.Journal.Limitation.WarningThresholdInMB / 1024#Write-Host "Hard Limit of this VPG in GB: " $HardLimitGB#Write-Host "Warning Threshold of this VPG in GB: " $WarningThresholdGB#Change Setting of VPG$VPGSettings.Journal.Limitation.HardLimitInMB = $LimitValueInMB$VPGSettings.Journal.Limitation.WarningThresholdInMB = $ThresholdValueInMB$data = @{Limitation = @{HardLimitInMB = $LimitValueInMBWarningThresholdInMB = $ThresholdValueInMB}}$json = $data | ConvertTo-Json$vmdata = @{Journal = @{Limitation = @{HardLimitInMB = $LimitValueInMBWarningThresholdInMB = $ThresholdValueInMB}}}$vmjson = $vmdata |ConvertTo-Json#Write Change to Zerto$ChangedVPG = Invoke-RestMethod -Uri $VPGSettingsJournalURL -Method Put -Body $json -Headers $zertoSessionHeader -ContentType $TypeJSONforeach ($vm in $VPGSettings.VMs) {$vmIdentifier = $vm.VmIdentifier$VPGSettingsVMsJournalURL = $VPGSettingsURL + "/vms/" + $vmIdentifier$VMHardLimitGB = $vm.Journal.Limitation.HardLimitInMB / 1024$VMWarningThreshold = $vm.Journal.Limitation.WarningThresholdInMB / 1024#Write-Host "VM ("$vm.VmIdentifier") has Limit of "$VMHardLimitGB " GB and Warning of " $VMWarningThreshold "GB"$ChangedVPG = Invoke-RestMethod -Uri $VPGSettingsVMsJournalURL -Method Put -Body $vmjson -Headers $zertoSessionHeader -ContentType $TypeJSON}$VPGCommit = Invoke-RestMethod -Method Post -Uri $VPGSettingsCommitURL -ContentType $TypeJSON -Headers $zertoSessionHeaderWrite-Host -ForegroundColor Green "Changed the valued successfully!"```'@ } ) } status = [ordered]@{ corpus = 315 alsoLike = @( [ordered]@{ ref = 'posts/how-to-disaster-recovery-mit-vmware-live-cyber-recovery' score = '1.00' } [ordered]@{ ref = 'posts/changing-default-backup-location-for-mssql-database' score = '1.00' } [ordered]@{ ref = 'solutions/vmware/vmware-cloud-foundation/addon/site-recovery-manager' score = '0.72' } ) search = '/en/search.json' }}$Page | ConvertTo-Json -Depth 32
// Code generated by the soultec.ch build. DO NOT EDIT.package mainimport ( "encoding/json" "os")var page = map[string]any{ "apiVersion": "soultec.ch/v1", "kind": "Post", "metadata": map[string]any{ "name": "zerto-automating-vpg-journal-limit-changes", "locale": "en", "labels": map[string]any{ "author": "dario-doerflinger", "capability/backup-recovery": 2.14, "vendor/vmware": 0.98, }, "annotations": map[string]any{ "source": "blog-content/posts/en/zerto-automating-vpg-journal-limit-changes.md", "route": "/en/insights/zerto-automating-vpg-journal-limit-changes/", "schema": "/nerd/schema/posts.json", "markdown": "/en/insights/zerto-automating-vpg-journal-limit-changes.md", }, }, "spec": map[string]any{ "title": "Automating VPG journal limit changes", "date": "2018-06-06", "author": "dario-doerflinger", "locale": "en", "summary": "I helped one of our customers implement Zerto in their environment.", "capabilities": []any{"backup-recovery"}, "vendors": []any{"vmware"}, "legacySlug": "zerto-automating-vpg-journal-limit-changes", "migrated": "2026-08-24", "draft": false, "sections": []any{ map[string]any{ "body": "I helped one of our customers implement Zerto in their environment. When you deploy Zerto and start protecting your VMs with it you need to know which applications you want to group together into virtual protection groups (VPGs). Another thing you'd define beforehand would be how many days you would want to be able to go back in time with Zerto and use that as a base to define the journal size limit of your VPGs.\n" + "\n" + "Now, some VMs produce a lot of I/Os while other are basically silent. This is key in how much space they are going to use and need in their VPG. So while for most of your VPGs the intially defined limit will be sufficient to reach your desired amount of time to go back it will not nearly be enough for your most I/O intensive workloads.\n" + "\n" + "When you then go ahead and change the journal limit on this VPG it will NOT update this setting on VMs that are already inside this VPG. When we first noticed this we thought this must be a bug and opened a case with Zerto. The support engineer then told us that this is not a bug but rather it's a feature… The customer and we had a different view on that so we started looking at the zerto API to remedy this unsatisfying situation.\n" + "\n" + "Long story short: Below is a script that will enable you to change the journal limit on a VPG and then iterate through all VMs in that VPG and set the same values (makes perfect sense in our use-case).\n" + "\n" + "Update: this script is now published at [GitHub](https://github.com/virtualFrog/PowerCLI-Scripts).\n" + "\n" + "```powershell\n" + "\n" + "param(\n" + "[Parameter(Mandatory = $true)][string]$zvm = \"zvm.virtualfrog.wordpress.com\",\n" + "[Parameter(Mandatory = $true)][string]$vpgName = \"Test\",\n" + "[Parameter(Mandatory = $true)][Int32]$LimitValueInGB = 300,\n" + "[Parameter(Mandatory = $true)][Int32]$ThresholdValueInGB = 250\n" + ")\n" + "\n" + "#----------------------------------------------------------[Declarations]----------------------------------------------------------\n" + "\n" + "# Build Base URL -> for all RestMethods\n" + "$baseURL = \"https://\" + $zvm + \":443/v1/\"\n" + "\n" + "# New Limit Value in MB\n" + "$LimitValueInMB = $LimitValueInGB * 1024\n" + "\n" + "# New Warning Threshold in MB\n" + "$ThresholdValueInMB = $ThresholdValueInGB * 1024\n" + "\n" + "# Responsetype\n" + "$TypeJSON = \"application/json\"\n" + "\n" + "#-----------------------------------------------------------[Functions]------------------------------------------------------------\n" + "\n" + "Function Get-ZertoSession ($ZertoUser, $ZertoPassword) {\n" + "# Authenticating with Zerto APIs\n" + "$xZertoSessionURL = $baseURL + \"session/add\"\n" + "$authInfo = (\"{0}:{1}\" -f $ZertoUser, $ZertoPassword)\n" + "$authInfo = [System.Text.Encoding]::UTF8.GetBytes($authInfo)\n" + "$authInfo = [System.Convert]::ToBase64String($authInfo)\n" + "$headers = @{Authorization = (\"Basic {0}\" -f $authInfo)}\n" + "$sessionBody = '{\"AuthenticationMethod\": \"1\"}'\n" + "\n" + "# Get Zerto Session Response\n" + "$xZertoSessionResponse = Invoke-WebRequest -Uri $xZertoSessionURL -Headers $headers -Method POST -Body $sessionBody -ContentType $TypeJSON\n" + "\n" + "# Extracting x-zerto-session from the response\n" + "$xZertoSession = $xZertoSessionResponse.headers.get_item(\"x-zerto-session\")\n" + "\n" + "# Return Zerto Session Header\n" + "return @{\"Accept\" = \"application/json\"; \"x-zerto-session\" = $xZertoSession}\n" + "}\n" + "\n" + "#-----------------------------------------------------------[Execution]------------------------------------------------------------\n" + "\n" + "# Get Zerto Session\n" + "$zertoSessionHeader = Get-ZertoSession -ZertoUser \"virtualFrog\" -ZertoPassword \"Password\"\n" + "\n" + "# Get VPG\n" + "$vpgListUrl = $baseURL + \"vpgs\"\n" + "$vpg = Invoke-RestMethod -Uri $vpgListUrl -Headers $zertoSessionHeader -ContentType $TypeJSON\n" + "\n" + "#Filter the one from the paramater\n" + "$vpgToEdit = $vpg |Where-Object {$_.VpgName -eq \"$vpgName\"}\n" + "Write-Host \"Changing Journal Limit and Threshold Settings of: \"($vpgToEdit.VpgName)\n" + "\n" + "#Get the identifier of this VPG\n" + "$VPGidentifier = $vpgToEdit.VpgIdentifier\n" + "$VPGidentifierJSON = '{\"VpgIdentifier\":\"' + $VPGidentifier + '\"}'\n" + "#$VPGidentifier\n" + "\n" + "# Get VPG Settings Identifier\n" + "$VPGSettingsIDURL = $baseURL + \"vpgSettings\"\n" + "$VPGSettingsIdentifier = Invoke-RestMethod -Method Post -Uri $VPGSettingsIDURL -Body $VPGidentifierJSON -ContentType $TypeJSON -Headers $zertoSessionHeader\n" + "\n" + "# Set VPG Settings URL\n" + "$VPGSettingsURL = $baseURL + \"vpgSettings/\" + $VPGSettingsIdentifier\n" + "$VPGSettingsBasicURL = $VPGSettingsURL + \"/basic\"\n" + "$VPGSettingsJournalURL = $VPGSettingsURL + \"/journal\"\n" + "$VPGSettingsCommitURL = $VPGSettingsURL + \"/commit\"\n" + "$VPGSettingsVMsJournalURL = $VPGSettingsURL + \"/vms\"\n" + "\n" + "# Get the actual VPG Settings\n" + "$VPGSettings = Invoke-RestMethod -Uri $VPGSettingsURL -Headers $zertoSessionHeader -ContentType $TypeJSON\n" + "\n" + "$HardLimitGB = $VPGSettings.Journal.Limitation.HardLimitInMB / 1024\n" + "$WarningThresholdGB = $VPGSettings.Journal.Limitation.WarningThresholdInMB / 1024\n" + "#Write-Host \"Hard Limit of this VPG in GB: \" $HardLimitGB\n" + "#Write-Host \"Warning Threshold of this VPG in GB: \" $WarningThresholdGB\n" + "\n" + "#Change Setting of VPG\n" + "$VPGSettings.Journal.Limitation.HardLimitInMB = $LimitValueInMB\n" + "$VPGSettings.Journal.Limitation.WarningThresholdInMB = $ThresholdValueInMB\n" + "\n" + "$data = @{Limitation = @{\n" + "HardLimitInMB = $LimitValueInMB\n" + "WarningThresholdInMB = $ThresholdValueInMB\n" + "}\n" + "}\n" + "$json = $data | ConvertTo-Json\n" + "\n" + "$vmdata = @{Journal = @{\n" + "Limitation = @{\n" + "HardLimitInMB = $LimitValueInMB\n" + "WarningThresholdInMB = $ThresholdValueInMB\n" + "}\n" + "}\n" + "}\n" + "$vmjson = $vmdata |ConvertTo-Json\n" + "#Write Change to Zerto\n" + "$ChangedVPG = Invoke-RestMethod -Uri $VPGSettingsJournalURL -Method Put -Body $json -Headers $zertoSessionHeader -ContentType $TypeJSON\n" + "\n" + "foreach ($vm in $VPGSettings.VMs) {\n" + "$vmIdentifier = $vm.VmIdentifier\n" + "$VPGSettingsVMsJournalURL = $VPGSettingsURL + \"/vms/\" + $vmIdentifier\n" + "$VMHardLimitGB = $vm.Journal.Limitation.HardLimitInMB / 1024\n" + "$VMWarningThreshold = $vm.Journal.Limitation.WarningThresholdInMB / 1024\n" + "\n" + "#Write-Host \"VM (\"$vm.VmIdentifier\") has Limit of \"$VMHardLimitGB \" GB and Warning of \" $VMWarningThreshold \"GB\"\n" + "$ChangedVPG = Invoke-RestMethod -Uri $VPGSettingsVMsJournalURL -Method Put -Body $vmjson -Headers $zertoSessionHeader -ContentType $TypeJSON\n" + "\n" + "}\n" + "\n" + "$VPGCommit = Invoke-RestMethod -Method Post -Uri $VPGSettingsCommitURL -ContentType $TypeJSON -Headers $zertoSessionHeader\n" + "Write-Host -ForegroundColor Green \"Changed the valued successfully!\"\n" + "```", }, }, }, "status": map[string]any{ "corpus": 315, "alsoLike": []any{ map[string]any{ "ref": "posts/how-to-disaster-recovery-mit-vmware-live-cyber-recovery", "score": "1.00", }, map[string]any{ "ref": "posts/changing-default-backup-location-for-mssql-database", "score": "1.00", }, map[string]any{ "ref": "solutions/vmware/vmware-cloud-foundation/addon/site-recovery-manager", "score": "0.72", }, }, "search": "/en/search.json", },}func main() { enc := json.NewEncoder(os.Stdout) enc.SetEscapeHTML(false) enc.SetIndent("", " ") if err := enc.Encode(page); err != nil { os.Exit(1) }}
// Code generated by the soultec.ch build. DO NOT EDIT.const page = { apiVersion: "soultec.ch/v1", kind: "Post", metadata: { name: "zerto-automating-vpg-journal-limit-changes", locale: "en", labels: { author: "dario-doerflinger", "capability/backup-recovery": 2.14, "vendor/vmware": 0.98, }, annotations: { source: "blog-content/posts/en/zerto-automating-vpg-journal-limit-changes.md", route: "/en/insights/zerto-automating-vpg-journal-limit-changes/", schema: "/nerd/schema/posts.json", markdown: "/en/insights/zerto-automating-vpg-journal-limit-changes.md", }, }, spec: { title: "Automating VPG journal limit changes", date: "2018-06-06", author: "dario-doerflinger", locale: "en", summary: "I helped one of our customers implement Zerto in their environment.", capabilities: ["backup-recovery"], vendors: ["vmware"], legacySlug: "zerto-automating-vpg-journal-limit-changes", migrated: "2026-08-24", draft: false, sections: [ { body: "I helped one of our customers implement Zerto in their environment. When you deploy Zerto and start protecting your VMs with it you need to know which applications you want to group together into virtual protection groups (VPGs). Another thing you'd define beforehand would be how many days you would want to be able to go back in time with Zerto and use that as a base to define the journal size limit of your VPGs.\n" + "\n" + "Now, some VMs produce a lot of I/Os while other are basically silent. This is key in how much space they are going to use and need in their VPG. So while for most of your VPGs the intially defined limit will be sufficient to reach your desired amount of time to go back it will not nearly be enough for your most I/O intensive workloads.\n" + "\n" + "When you then go ahead and change the journal limit on this VPG it will NOT update this setting on VMs that are already inside this VPG. When we first noticed this we thought this must be a bug and opened a case with Zerto. The support engineer then told us that this is not a bug but rather it's a feature… The customer and we had a different view on that so we started looking at the zerto API to remedy this unsatisfying situation.\n" + "\n" + "Long story short: Below is a script that will enable you to change the journal limit on a VPG and then iterate through all VMs in that VPG and set the same values (makes perfect sense in our use-case).\n" + "\n" + "Update: this script is now published at [GitHub](https://github.com/virtualFrog/PowerCLI-Scripts).\n" + "\n" + "```powershell\n" + "\n" + "param(\n" + "[Parameter(Mandatory = $true)][string]$zvm = \"zvm.virtualfrog.wordpress.com\",\n" + "[Parameter(Mandatory = $true)][string]$vpgName = \"Test\",\n" + "[Parameter(Mandatory = $true)][Int32]$LimitValueInGB = 300,\n" + "[Parameter(Mandatory = $true)][Int32]$ThresholdValueInGB = 250\n" + ")\n" + "\n" + "#----------------------------------------------------------[Declarations]----------------------------------------------------------\n" + "\n" + "# Build Base URL -> for all RestMethods\n" + "$baseURL = \"https://\" + $zvm + \":443/v1/\"\n" + "\n" + "# New Limit Value in MB\n" + "$LimitValueInMB = $LimitValueInGB * 1024\n" + "\n" + "# New Warning Threshold in MB\n" + "$ThresholdValueInMB = $ThresholdValueInGB * 1024\n" + "\n" + "# Responsetype\n" + "$TypeJSON = \"application/json\"\n" + "\n" + "#-----------------------------------------------------------[Functions]------------------------------------------------------------\n" + "\n" + "Function Get-ZertoSession ($ZertoUser, $ZertoPassword) {\n" + "# Authenticating with Zerto APIs\n" + "$xZertoSessionURL = $baseURL + \"session/add\"\n" + "$authInfo = (\"{0}:{1}\" -f $ZertoUser, $ZertoPassword)\n" + "$authInfo = [System.Text.Encoding]::UTF8.GetBytes($authInfo)\n" + "$authInfo = [System.Convert]::ToBase64String($authInfo)\n" + "$headers = @{Authorization = (\"Basic {0}\" -f $authInfo)}\n" + "$sessionBody = '{\"AuthenticationMethod\": \"1\"}'\n" + "\n" + "# Get Zerto Session Response\n" + "$xZertoSessionResponse = Invoke-WebRequest -Uri $xZertoSessionURL -Headers $headers -Method POST -Body $sessionBody -ContentType $TypeJSON\n" + "\n" + "# Extracting x-zerto-session from the response\n" + "$xZertoSession = $xZertoSessionResponse.headers.get_item(\"x-zerto-session\")\n" + "\n" + "# Return Zerto Session Header\n" + "return @{\"Accept\" = \"application/json\"; \"x-zerto-session\" = $xZertoSession}\n" + "}\n" + "\n" + "#-----------------------------------------------------------[Execution]------------------------------------------------------------\n" + "\n" + "# Get Zerto Session\n" + "$zertoSessionHeader = Get-ZertoSession -ZertoUser \"virtualFrog\" -ZertoPassword \"Password\"\n" + "\n" + "# Get VPG\n" + "$vpgListUrl = $baseURL + \"vpgs\"\n" + "$vpg = Invoke-RestMethod -Uri $vpgListUrl -Headers $zertoSessionHeader -ContentType $TypeJSON\n" + "\n" + "#Filter the one from the paramater\n" + "$vpgToEdit = $vpg |Where-Object {$_.VpgName -eq \"$vpgName\"}\n" + "Write-Host \"Changing Journal Limit and Threshold Settings of: \"($vpgToEdit.VpgName)\n" + "\n" + "#Get the identifier of this VPG\n" + "$VPGidentifier = $vpgToEdit.VpgIdentifier\n" + "$VPGidentifierJSON = '{\"VpgIdentifier\":\"' + $VPGidentifier + '\"}'\n" + "#$VPGidentifier\n" + "\n" + "# Get VPG Settings Identifier\n" + "$VPGSettingsIDURL = $baseURL + \"vpgSettings\"\n" + "$VPGSettingsIdentifier = Invoke-RestMethod -Method Post -Uri $VPGSettingsIDURL -Body $VPGidentifierJSON -ContentType $TypeJSON -Headers $zertoSessionHeader\n" + "\n" + "# Set VPG Settings URL\n" + "$VPGSettingsURL = $baseURL + \"vpgSettings/\" + $VPGSettingsIdentifier\n" + "$VPGSettingsBasicURL = $VPGSettingsURL + \"/basic\"\n" + "$VPGSettingsJournalURL = $VPGSettingsURL + \"/journal\"\n" + "$VPGSettingsCommitURL = $VPGSettingsURL + \"/commit\"\n" + "$VPGSettingsVMsJournalURL = $VPGSettingsURL + \"/vms\"\n" + "\n" + "# Get the actual VPG Settings\n" + "$VPGSettings = Invoke-RestMethod -Uri $VPGSettingsURL -Headers $zertoSessionHeader -ContentType $TypeJSON\n" + "\n" + "$HardLimitGB = $VPGSettings.Journal.Limitation.HardLimitInMB / 1024\n" + "$WarningThresholdGB = $VPGSettings.Journal.Limitation.WarningThresholdInMB / 1024\n" + "#Write-Host \"Hard Limit of this VPG in GB: \" $HardLimitGB\n" + "#Write-Host \"Warning Threshold of this VPG in GB: \" $WarningThresholdGB\n" + "\n" + "#Change Setting of VPG\n" + "$VPGSettings.Journal.Limitation.HardLimitInMB = $LimitValueInMB\n" + "$VPGSettings.Journal.Limitation.WarningThresholdInMB = $ThresholdValueInMB\n" + "\n" + "$data = @{Limitation = @{\n" + "HardLimitInMB = $LimitValueInMB\n" + "WarningThresholdInMB = $ThresholdValueInMB\n" + "}\n" + "}\n" + "$json = $data | ConvertTo-Json\n" + "\n" + "$vmdata = @{Journal = @{\n" + "Limitation = @{\n" + "HardLimitInMB = $LimitValueInMB\n" + "WarningThresholdInMB = $ThresholdValueInMB\n" + "}\n" + "}\n" + "}\n" + "$vmjson = $vmdata |ConvertTo-Json\n" + "#Write Change to Zerto\n" + "$ChangedVPG = Invoke-RestMethod -Uri $VPGSettingsJournalURL -Method Put -Body $json -Headers $zertoSessionHeader -ContentType $TypeJSON\n" + "\n" + "foreach ($vm in $VPGSettings.VMs) {\n" + "$vmIdentifier = $vm.VmIdentifier\n" + "$VPGSettingsVMsJournalURL = $VPGSettingsURL + \"/vms/\" + $vmIdentifier\n" + "$VMHardLimitGB = $vm.Journal.Limitation.HardLimitInMB / 1024\n" + "$VMWarningThreshold = $vm.Journal.Limitation.WarningThresholdInMB / 1024\n" + "\n" + "#Write-Host \"VM (\"$vm.VmIdentifier\") has Limit of \"$VMHardLimitGB \" GB and Warning of \" $VMWarningThreshold \"GB\"\n" + "$ChangedVPG = Invoke-RestMethod -Uri $VPGSettingsVMsJournalURL -Method Put -Body $vmjson -Headers $zertoSessionHeader -ContentType $TypeJSON\n" + "\n" + "}\n" + "\n" + "$VPGCommit = Invoke-RestMethod -Method Post -Uri $VPGSettingsCommitURL -ContentType $TypeJSON -Headers $zertoSessionHeader\n" + "Write-Host -ForegroundColor Green \"Changed the valued successfully!\"\n" + "```", }, ], }, status: { corpus: 315, alsoLike: [ { ref: "posts/how-to-disaster-recovery-mit-vmware-live-cyber-recovery", score: "1.00", }, { ref: "posts/changing-default-backup-location-for-mssql-database", score: "1.00", }, { ref: "solutions/vmware/vmware-cloud-foundation/addon/site-recovery-manager", score: "0.72", }, ], search: "/en/search.json", },};console.log(JSON.stringify(page, null, 2));

# 161 lines · YAML · validated at build# 58 lines · JSON · validated at build# 176 lines · TOML · validated at build# 186 lines · XML · validated at build# 188 lines · Python · read back at build, equals the JSON record# 185 lines · PowerShell · read back at build, equals the JSON record# 198 lines · Go · read back at build, equals the JSON record# 183 lines · JavaScript · read back at build, equals the JSON record · served at /en/insights/zerto-automating-vpg-journal-limit-changes.md

Post · 2018-06-06

Automating VPG journal limit changes

I helped one of our customers implement Zerto in their environment.

2018-06-06Date
Dario DörflingerAuthor
4Min read
Vendors VMware 0.98

This post is from 2018. It stays online because people still look for it, but it describes the products as they were then.

I helped one of our customers implement Zerto in their environment. When you deploy Zerto and start protecting your VMs with it you need to know which applications you want to group together into virtual protection groups (VPGs). Another thing you’d define beforehand would be how many days you would want to be able to go back in time with Zerto and use that as a base to define the journal size limit of your VPGs.

Now, some VMs produce a lot of I/Os while other are basically silent. This is key in how much space they are going to use and need in their VPG. So while for most of your VPGs the intially defined limit will be sufficient to reach your desired amount of time to go back it will not nearly be enough for your most I/O intensive workloads.

When you then go ahead and change the journal limit on this VPG it will NOT update this setting on VMs that are already inside this VPG. When we first noticed this we thought this must be a bug and opened a case with Zerto. The support engineer then told us that this is not a bug but rather it’s a feature… The customer and we had a different view on that so we started looking at the zerto API to remedy this unsatisfying situation.

Long story short: Below is a script that will enable you to change the journal limit on a VPG and then iterate through all VMs in that VPG and set the same values (makes perfect sense in our use-case).

Update: this script is now published at GitHub.


param(
[Parameter(Mandatory = $true)][string]$zvm = "zvm.virtualfrog.wordpress.com",
[Parameter(Mandatory = $true)][string]$vpgName = "Test",
[Parameter(Mandatory = $true)][Int32]$LimitValueInGB = 300,
[Parameter(Mandatory = $true)][Int32]$ThresholdValueInGB = 250
)

#----------------------------------------------------------[Declarations]----------------------------------------------------------

# Build Base URL -> for all RestMethods
$baseURL = "https://" + $zvm + ":443/v1/"

# New Limit Value in MB
$LimitValueInMB = $LimitValueInGB * 1024

# New Warning Threshold in MB
$ThresholdValueInMB = $ThresholdValueInGB * 1024

# Responsetype
$TypeJSON = "application/json"

#-----------------------------------------------------------[Functions]------------------------------------------------------------

Function Get-ZertoSession ($ZertoUser, $ZertoPassword) {
# Authenticating with Zerto APIs
$xZertoSessionURL = $baseURL + "session/add"
$authInfo = ("{0}:{1}" -f $ZertoUser, $ZertoPassword)
$authInfo = [System.Text.Encoding]::UTF8.GetBytes($authInfo)
$authInfo = [System.Convert]::ToBase64String($authInfo)
$headers = @{Authorization = ("Basic {0}" -f $authInfo)}
$sessionBody = '{"AuthenticationMethod": "1"}'

# Get Zerto Session Response
$xZertoSessionResponse = Invoke-WebRequest -Uri $xZertoSessionURL -Headers $headers -Method POST -Body $sessionBody -ContentType $TypeJSON

# Extracting x-zerto-session from the response
$xZertoSession = $xZertoSessionResponse.headers.get_item("x-zerto-session")

# Return Zerto Session Header
return @{"Accept" = "application/json"; "x-zerto-session" = $xZertoSession}
}

#-----------------------------------------------------------[Execution]------------------------------------------------------------

# Get Zerto Session
$zertoSessionHeader = Get-ZertoSession -ZertoUser "virtualFrog" -ZertoPassword "Password"

# Get VPG
$vpgListUrl = $baseURL + "vpgs"
$vpg = Invoke-RestMethod -Uri $vpgListUrl -Headers $zertoSessionHeader -ContentType $TypeJSON

#Filter the one from the paramater
$vpgToEdit = $vpg |Where-Object {$_.VpgName -eq "$vpgName"}
Write-Host "Changing Journal Limit and Threshold Settings of: "($vpgToEdit.VpgName)

#Get the identifier of this VPG
$VPGidentifier = $vpgToEdit.VpgIdentifier
$VPGidentifierJSON = '{"VpgIdentifier":"' + $VPGidentifier + '"}'
#$VPGidentifier

# Get VPG Settings Identifier
$VPGSettingsIDURL = $baseURL + "vpgSettings"
$VPGSettingsIdentifier = Invoke-RestMethod -Method Post -Uri $VPGSettingsIDURL -Body $VPGidentifierJSON -ContentType $TypeJSON -Headers $zertoSessionHeader

# Set VPG Settings URL
$VPGSettingsURL = $baseURL + "vpgSettings/" + $VPGSettingsIdentifier
$VPGSettingsBasicURL = $VPGSettingsURL + "/basic"
$VPGSettingsJournalURL = $VPGSettingsURL + "/journal"
$VPGSettingsCommitURL = $VPGSettingsURL + "/commit"
$VPGSettingsVMsJournalURL = $VPGSettingsURL + "/vms"

# Get the actual VPG Settings
$VPGSettings = Invoke-RestMethod -Uri $VPGSettingsURL -Headers $zertoSessionHeader -ContentType $TypeJSON

$HardLimitGB = $VPGSettings.Journal.Limitation.HardLimitInMB / 1024
$WarningThresholdGB = $VPGSettings.Journal.Limitation.WarningThresholdInMB / 1024
#Write-Host "Hard Limit of this VPG in GB: " $HardLimitGB
#Write-Host "Warning Threshold of this VPG in GB: " $WarningThresholdGB

#Change Setting of VPG
$VPGSettings.Journal.Limitation.HardLimitInMB = $LimitValueInMB
$VPGSettings.Journal.Limitation.WarningThresholdInMB = $ThresholdValueInMB

$data = @{Limitation = @{
HardLimitInMB = $LimitValueInMB
WarningThresholdInMB = $ThresholdValueInMB
}
}
$json = $data | ConvertTo-Json

$vmdata = @{Journal = @{
Limitation = @{
HardLimitInMB = $LimitValueInMB
WarningThresholdInMB = $ThresholdValueInMB
}
}
}
$vmjson = $vmdata |ConvertTo-Json
#Write Change to Zerto
$ChangedVPG = Invoke-RestMethod -Uri $VPGSettingsJournalURL -Method Put -Body $json -Headers $zertoSessionHeader -ContentType $TypeJSON

foreach ($vm in $VPGSettings.VMs) {
$vmIdentifier = $vm.VmIdentifier
$VPGSettingsVMsJournalURL = $VPGSettingsURL + "/vms/" + $vmIdentifier
$VMHardLimitGB = $vm.Journal.Limitation.HardLimitInMB / 1024
$VMWarningThreshold = $vm.Journal.Limitation.WarningThresholdInMB / 1024

#Write-Host "VM ("$vm.VmIdentifier") has Limit of "$VMHardLimitGB " GB and Warning of " $VMWarningThreshold "GB"
$ChangedVPG = Invoke-RestMethod -Uri $VPGSettingsVMsJournalURL -Method Put -Body $vmjson -Headers $zertoSessionHeader -ContentType $TypeJSON

}

$VPGCommit = Invoke-RestMethod -Method Post -Uri $VPGSettingsCommitURL -ContentType $TypeJSON -Headers $zertoSessionHeader
Write-Host -ForegroundColor Green "Changed the valued successfully!"

You might also like