snapshotmanager.pl - List, Create, Revert, Goto, Rename, Remove, Remove All Snapshot/s.
snapshotmanager.pl --operation <List|Create|Revert|Goto|Rename|Remove|RemoveAll> [options]
This VI Perl command-line utility provides an interface for seven basic operations for Snapshot:
Listing all snapshots for one or more virtual machines, Creating a snapshot for one or more virtual machines, Reverting to the current snapshot for a single virtual machine, Reverting to the specified snapshot for a single virtual machine, Renaming a named snapshot for a single virtual machine, Removing all snapshots for a single virtual machine, Removing a named snapshot for one or more virtual machines.
Operation to be performed. Must be one of the following: I<List> (List all snapshots for one or more virtual machines), I<Create> (Creating a snapshot for one or more virtual machines), I<Revert> (Reverting to the current snapshot for a single virtual machine), I<GoTo> (Reverting to the specified snapshot for a single virtual machine), I<Rename> (Renaming a named snapshot [and children] for a single virtual machine), I<RemoveAll> (Removing all snapshots for a single virtual machine), I<Remove> (Removing a named snapshot for one or more virtual machines)
Optional. The name of the source virtual machine.
Optional. Name of the target datacenter for selection of virtual machines.
Optional. Name of the target resource pool for selection of virtual machines.
Optional. Name of the target host for selection of virtual machines.
Optional. Name of the target folder for selection of virtual machines.
Optional. Ip Address of target virtual machine.
Optional. Power Status for selection of virtual machines.
Optional. Guest OS for selection of virtual machines.
Optional. The name of the source virtual machine.
Optional. Name of the target datacenter for selection of virtual machines.
Optional. Name of the target resource pool for selection of virtual machines.
Optional. Name of the target host for selection of virtual machines.
Optional. Name of the target folder for selection of virtual machines.
Optional. Ip Address of target virtual machine.
Optional. Power Status for selection of virtual machines.
Optional. Guest OS for selection of virtual machines.
Required. Name of the new snapshot for operation <Create>
Required. The name of the source virtual machine.
Optional. Name of Target Host.
Required. The name of the source virtual machine.
Required. Name of snapshot to revert to.
Optional. Name of Target Host.
Required. The name of the source virtual machine.
Required. Name of snapshot to be renamed.
Required. New name for the snapshot.
Required. The name of the source virtual machine.
Optional. The name of the source virtual machine.
Optional. Name of the target datacenter for selection of virtual machines.
Optional. Name of the target resource pool for selection of virtual machines.
Optional. Name of the target host for selection of virtual machines.
Optional. Name of the target folder for selection of virtual machines.
Optional. Ip Address of target virtual machine.
Optional. Power Status for selection of virtual machines.
Optional. Guest OS for selection of virtual machines.
Required. Name of snapshot to be removed for operation Remove
Required. Binary value 0|1 to decide whether children snapshots also needs to be removed or not for operation I <Remove>
List all the snapshots :
perl snapshotmanager.pl --server <server host> --url <https://192.168.111.52/sdk/vimService>
--username <username> --password <password> --operation List
--vmname <Virtual Machine Name>
Create snapshot :
perl snapshotmanager.pl --server <server host> --url <https://192.168.111.52/sdk/vimService>
--username <username> --password <password> --operation Create
--vmname <Virtual Machine Name> --snapshotname <Snapshot Name>
Revert snapshot :
perl snapshotmanager.pl --server <server_host> --url <https://192.168.111.52/sdk/vimService>
--username <username> --password <password> --operation Revert
--vmname <Virtual Machine Name>
GoTo snapshot :
perl snapshotmanager.pl --server <server_host> --url <https://192.168.111.52/sdk/vimService>
--username <username> --password <password> --operation Goto
--vmname <Virtual Machine Name> --revert <Name of Snapshot>
Rename snapshot :
perl snapshotmanager.pl --server <server_host> --url <https://192.168.111.52/sdk/vimService>
--username <username> --password <password> --operation Rename
--rename <Name of snapshot to be renamed> --name <New name of snapshot>
--vmname <Virtual Machine Name>
Remove all :
perl snapshotmanager.pl --server <server_host> --url <https://192.168.111.52/sdk/vimService>
--username <username> --password <password> --operation RemoveAll
--vmname <Virtual Machine Name>
Remove :
perl snapshotmanager.pl --server <server_host> --url <https://192.168.111.52/sdk/vimService>
--username <username> --password <password> --operation Remove
--vmname <Virtual Machine Name> --remove <Name of snapshot>
--children <1|0>
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.