NAME

vmsnapshot.pl - Creates snapshots of virtual machines.


SYNOPSIS

 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>]


DESCRIPTION

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.


OPTIONS

GENERAL OPTIONS

sname

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

VM OPTIONS

vmname

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.

powerstatus

Optional. Power state of the virtual machine.

ipaddress

Optional. IP address of the virtual machine.

guest_os

Optional. Guest operating system running on the virtual machine.

INVENTORY OPTIONS

host

Optional. Name of the host.

datacenter

Optional. Name of the datacenter.

folder

Optional. Folder name.

pool

Optional. Name of the resource pool.


EXAMPLES

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


KNOWN ISSUE

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.


SUPPORTED PLATFORMS

All operations work with VMware VirtualCenter 2.0.1

All operations work with VMware ESX Server 3.0.1.