- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Automating VM clone/Snapshot/Restore using Vsphere CLI
Hi all,
I am using VMware Vsphere CLI options for automating my environment. While automating I ran into below queries.
_VM Cloning _
Currently by looking into the
documentation I used the CLI “vmkfstool –clonevirtualdisk” for cloning the VM
Image. I observed that the CLI only cloned the “<VM Name>.vmdk” file but
other dependent configuration files like “<VM Name>.nvram , <VM
Name>.vmx” etc were not cloned by the CLI.
How can we clone the existing
VMWare images using CLI so that we have all the required files like “ ’.vmdk’,
‘.vmx’, ‘.nvram’ ” etc available with us?
_*VM Snapshot/Restore*_
How can we list the names of all
the snapshots available for a particular VM Image using
CLI?How can we restore a particular
snapshot from list of available snapshots using CLI?
Also please let me know if we have a CLI that can be executed remotely using which we can Query a particular VM for its MAC and IP Address.
Thanks and Regards
-Saurabh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
First off, what version of ESX(i) are you using? It's a little hard to read your post, please reformat it so it's more readable.
If you have vCenter, you can take a look at vmclone.pl and snapshotmanager.pl to clone and perform snapshot of your VMs as part of the vSphere SDK for Perl.
If you would like to extract the VM's MAC Address, take a look at this Perl script: , you can easily modify this script to extract the IP Address as well. Remember for this information within the VM, you'll need to ensure you have VMware Tools installed else you will not be able to retrieve this information.
=========================================================================
William Lam
VMware vExpert 2009
VMware ESX/ESXi scripts and resources at:
VMware Code Central - Scripts/Sample code for Developers and Administrators
![]()
If you find this information useful, please award points for "correct" or "helpful".