vmsnapshot.pl - Creates snapshots of virtual machines.
vmsnapshot.pl --url <web service URL> --username <server login name>
--password <server login password> --sname <snapshot name>
[--vmname <virtual machine name>] [--host <host name>]
[--datacenter <datacenter name>] [--folder <folder name>]
[--ipaddress <IP address of the virtual machine>]
[-- powerstatus <virtual machine status>]
[--guest_os <guest OS running>] [--pool <resource pool name>]
This VI Perl command-line utility creates snapshots of virtual machines based on the filter criteria. A snapshot captures the entire state of a virtual machine at the time the user take the snapshot.
Required. The name of the snapshot. The name of the newly created snapshot will be the concatenation of virtual machine name and 'sname'. For example if the virtual machine name is 'VM2' and sname is 'snap23', the name of the newly created snapshot will be VM2$snap23
Optional. Name of the virtual machine whose snapshot is to be created. 'vnmame' can also be a sub string. Suppose you want to create snapshot of all the virtual machine which contains the sub string 'ba', then 'vmname' should be 'ba'. If this option is not specified, then the CreateSnapshot operation will be performed on a set of virtual machines based on the other parameters.
Optional. Power state of the virtual machine.
Optional. IP address of the virtual machine.
Optional. Guest operating system running on the virtual machine.
Optional. Name of the host.
Optional. Name of the datacenter.
Optional. Folder name.
Optional. Name of the resource pool.
Create snapshots for all the virtual machines which are in resource pool 'PoolA' and whose power status is 'ON'. Let the name of the snapshot be 'Snap14May':
vmsnapshot.pl --url https://192.168.111.52:443/sdk/webService
--username administrator --password mypassword
--sname Snap14May --pool PoolA --powerstatus On
Create snapshots for all the virtual machines which are in datacenter 'CenterABC', resource pool 'PoolA' and whose power status is 'ON'. Let the name of the snapshot be 'Snap14May':
vmsnapshot.pl --url https://192.168.111.52:443/sdk/webService
--username administrator --password mypassword
--sname Snap14May --datacenter CenterABC --pool PoolA
--powerstatus On
Create snapshots for all the virtual machines which are in folder 'Team2' and whose guest OS is linux. Let the name of the snapshot be 'Snap14May':
vmsnapshot.pl --url https://192.168.111.52:443/sdk/webService
--username administrator --password mypassword
--sname Snap14May --folder Team2 --geustOS linux
Create snapshots for all the virtual machines whoose name contains string 'VM2'. Let the name of the snapshot be 'Snap14May':
vmsnapshot.pl --url https://192.168.111.52:443/sdk/webService
--username administrator --password mypassword
--sname Snap14May --vmname VM2
If you suspend a virtual machine and then take two successive snapshots, the second snapshot operation fails with the error "Failure due to a malformed request to the server". This error is expected and does not indicate a problem, because suspended virtual machines do not change, the second snapshot would overwrite the existing snapshot with identical data.
All operations work with VMware VirtualCenter 2.0.1
All operations work with VMware ESX Server 3.0.1.