Use vmclone.pl script to clone virtual machines
I stumbled across another interesting Perl script. Paul Gregg – Projects – VMware ESX vmclone.p is a web page that explains the vmclone.pl script which automates cloning a virtual machine. Not a big deal if you have Virtual Center, but for those environments where you have stand alone ESX hosts this script can make life a little easier.
From the web page and the notes of the script:
# vmclone.pl is a perl script that was written to address the deficiencies # in ESX server when you want to create a complete duplicate of a Virtual # Machine. Usually you would have had to clone the disk, then recreate # the virtual machine to use that disk. With vmclone.pl you change to the # directory where your VMs are stored (usually /vmfs/volumes/storage1) # and run the command: vmclone.pl "source dir" "destination dir". # # If any of the filenames within the source dir contain "source dir" # then they will be replaced with "destination dir". The vmx VM # specification file, and related snapshot description files will be # modified automatically to point to the correct new filenames. # # This also maintains any snapshots in the cloned VM so you can see them # in the Snapshot Manager and still revert to earlier snaps.# Installation: Copy this file to /usr/local/bin/vmclone.pl, make it # executable and then ensure it is in your path. e.g.: # mkdir -p /usr/local/bin # cp vmclone.pl /usr/local/bin/ # chmod a+rx /usr/local/bin/vmclone.pl # ln -s /usr/local/bin/vmclone.pl /usr/bin/vmclone # # Type "vmclone" on its own for usage guidelines.
You can cut and paste the entire script at the link above or I have saved the script on the VM /ETC Files Page.











