Script 4 in my blog series on scripting Zerto 6.0 with PowerShell 6.0 is Bulk Re-IP address configuration from a CSV. Since I started this series I’ve had multiple requests for this via my blog chat (powered by Drift). If you’d like anything specific for script 5 then you know where to go!
Let’s start with the use case. You’ve protected some VMs in Virtual Protection Groups (VPGs), and now you need to configure IP addresses for Zerto to automatically re-configure each VM NIC upon failover/test. This is easily done via the GUI, simply edit your VPG and go to the NICs settings section:
But wait, you have to manually type in every single IP address, subnet, gateway, DNS, and DNS suffix? Yes, you do. Ouch. To edit just 1 VM NIC on 1 VM you’re talking 13 clicks and 71 characters entered. Scale this out and to configure IP addresses for 200 VMs each with 1 NIC you’ll need to type 14,200 characters and click 2,600 times. 1,000 VMs and now you’re on 71,000 characters typed and 13,000 clicks. That’s bad, let’s not do that!
The solution is of course to automate this using PowerShell and Zerto REST APIs. Because I had to make quite a few changes to this script for Zerto 6.0, for this example I’ve created both a PowerShell 5.0 and PowerShell 6.0 version for you to download below:
Both are only compatible with Zerto 6.0 onwards and for Zerto to be able to change the IP address in protected VMs they need VMware tools installed. I tested both scripts with Windows and Linux VMs replicating vSphere to vSphere (no other topology is supported by the Zerto REST API). Unzip the file to “C:\ZertoBulkReIPv6\” and at the start of the 2 scripts configure the $ZertoServer variable. Run the -Export.ps1 script to automatically create a CSV list of all your current protected VMs, with a line created for each VM NIC and its current failover network settings.
Edit the CSV with your desired settings, then run the -Import.ps1 script to programmatically update Zerto with your new networking config. If all has gone well you’ve now updated every single NIC with 2 simple scripts and saved yourself hours of your life. If you just gained this time back, then tweet me @joshuastenhouse saying what you did instead. Happy scripting,