The VI SDK includes several scripts (batch files for Windows environments; shell scripts for Linux environments) to facilitate building and running the samples. These batch files require setting several environment variables. (See the Developers Setup Guide for complete information.)
Note that if your development workstation is setup using Java JDK 1.5 and Axis 1.4, you can use the sample applications, as is, without re-generating client-side proxy code and re-compiling. To run any samples, simply use the run.bat (or run.sh).
The SDK includes scripts (run.bat for Windows; run.sh for Linux) to simplify running the Java samples.
The Java samples provide support several common parameters.
In addition to the common options listed in the table, specific Java samples may implement specific options, relevant for the application.
To display help text for any application, simply run the application without any parameters. Parameters for sample applications are also available in the Javadoc, and in the listing in the table.
Sample, description, and examples...
|
|
AddVirtualNic.java |
Adds a virtual NIC (network interface card or network interface controller) to a virtual switch.
|
| Parameters: |
vswitch Required. Name of the switch.
portgroup Required. Name of the port group.
ipaddress Required. IP address for the NIC.
host Optional. Name of the host.
datacenter Optional. Name of the datacenter.
|
Examples:
To add a virtual NIC to a virtual machines virtual switch port group:
run.bat com.vmware.samples.host.AddVirtualNic --url <webserviceurl> --username <username> --password <password> --vswitch <mySwitch> --host <host> --datacenter <mydatacenter> --portgroup <myportgroup> --ipaddress <nnn.nnn.nnn.nnn>
To add add a virtual NIC to a virtual machines virtual switch port group without specifying the host name:
run.bat com.vmware.samples.host.AddVirtualNic --url <webserviceurl> --username <username> --password <password> --vswitch <mySwitch> --datacenter <mydatacenter> --portgroup <myportgroup> --ipaddress <nnn.nnn.nnn.nnn>
To add a Host VirtualNic to a PortGroup on a Virtual Switch without specifying the datacenter name:
run.bat com.vmware.samples.host.AddVirtualNic --url <webserviceurl> --username <username> --password <password> --vswitch <mySwitch> --portgroup <myportgroup> --ipaddress <nnn.nnn.nnn.nnn>
|
|
|
AddVirtualSwitch.java |
Adds a virtual switch. |
| Parameters: |
vswitch Required. Name of the switch to be added.
host Optional. Name of the host.
datacenter Optional. Name of the datacenter
|
Examples:
To add a Virtual Switch to a VirtualCenter:
run.bat com.vmware.samples.host.AddVirtualSwitch --url <webserviceurl> --username <username> --password <password> --vswitch <mySwitch> --datacenter <mydatacenter>
|
|
AddVirtual SwitchPortGroup.java | Add a virtual switch to a port group.
| | Parameters: |
vswitch Required. Name of the switch to add portgroup.
portgroup Required. Name of the port group.
host Optional. Name of the host.
datacenter Optional. Name of the datacenter.
|
Examples:
To add a Virtual switch Port Group:
run.bat com.vmware.samples.host.AddVirtualSwitchPortGroup --url <webserviceurl> --username <username> --password <password> --vswitch <mySwitch> --datacenter <mydatacenter> --portgroup <myportgroup> --host<host>
To add a Virtual switch Port Group without specifying the host:
run.bat com.vmware.samples.host.AddVirtualSwitchPortGroup --url <webserviceurl> --username <username> --password <password> --vswitch <mySwitch> --datacenter <mydatacenter> --portgroup <myportgroup>
To add a Virtual switch Port Group without specifying the datacenter:
run.bat com.vmware.samples.host.AddVirtualSwitchPortGroup --url <webserviceurl> --username <username> --password <password> --vswitch <mySwitch> --portgroup <myportgroup>
|
|
| Basics.java | Displays the performance parameters of ESX Server in the specified format, as follows:
Perfomance Interval:
Interval Name
Interval Period
Interval Length
Performance counters:
Host perf capabilities:
Summary supported
Current supported
Current refresh rate
|
| Parameters: |
info Required. <interval> | <counter> | <host>
host Optional. Name of the host system
|
Examples: To display the names and description of all the performance counters on the specified VirtualCenter:
run.bat com.vmware.samples.performance Basic --url <webserviceurl> --username <username> --password <password> --info<interval or counter or host>> --host <name of the host server>
To display counters, names, sampling period, and length of all performance intervals on this VirtualCenter:
run.bat com.vmware.samples.performance Basic --url <webserviceurl> --username <username> --password <password> --info<interval> --host <name of the host server>
To display the names and description of all the performance counters on the ESX host:
run.bat com.vmware.samples.performance Basic --url <webserviceurl> --username <username> --password <password> --info<counter> --host <name of the host server>
To display the names and description of all the performance counters on this host and all metrics available on this host:
run.bat com.vmware.samples.performance Basic --url <webserviceurl> --username <username> --password <password> --info<host>> --host <name of the host server>
|
|
| Browser.java |
Prints all managed entities with type, reference value, property names and values, inner object type, property, and reference values.
|
Examples:
run.bat com.vmware.samples.general.Browser --url <webserviceurl> --username
<username> --password <password>
|
|
| ColdMigration.java |
Puts all virtual machine files in the specified Datacenter and Datastore, and then registers and reconfigures the virtual machine on its new location.
|
| Parameters: | vmname Required. Name of the virtual machine
localpath Required. Local directory from which to copy files.
datacenter Required. Name of the datacenter.
datastorename Required. Name of the datastore.
|
Examples:
To migrate all virtual machine files from the local disk to the ESX host:
run.bat com.vmware.samples.httpfileaccess.ColdMigration --url <webserviceurl>
--username <username>--password <password> --vmname <vmname> --localpath<localpath>
--datacenter <datacenter> --datastorename <datastorename>
|
|
| Connect.java |
Connects to the ESX Server or to a VirtualCenter Server system. |
Examples:
run.bat com.vmware.samples.general.Connect --url <webserviceurl> --username <username> --password <password>
|
|
| Create.java |
Create managed entity, such as a standalone host, cluster, datacenter, or folder.
| | Parameters: |
parentName Required. Specifies the name of the parent folder.
itemType Required. Type of object to add; for example, Host-Standalone, Cluster, Datacenter, Folder, and so on.
itemName Required. Name of the item added.
|
Examples:
To create a folder named myFolder under root folder Root:
run.bat com.vmware.samples.general.Create --url <webserviceurl>
--username <username> --password <password> --parentName <Root>
--itemType <Folder> --itemName <myFolder>
To create a datacenter named myDatacenter under root folder Root:
run.bat com.vmware.samples.general.Create --url <webserviceurl>
--username <username> --password <password> --parentName <Root>
--itemType <Datacenter> --itemName <myDatacenter>
To create a cluster named myCluster under root folder Root:
run.bat com.vmware.samples.general.Create --url <webserviceurl>
--username <username> --password <password> --parentName <Root>
--itemType <Cluster> --itemName <myCluster>
|
|
| Delete.java |
Deletes the specified managed entity from the inventory tree. The managed entity can be a VirtualMachine, ClusterComputeResource, or a Folder.
| | Parameters: | meName Required. The name of the managed entity. [ VirtualMachine | ClusterComputeResource | Folder ]
|
Examples:
To delete a folder named 'testFolder':
run.bat com.vmware.samples.general.Delete --url <webserviceurl>
--username <username> --password <password> --meName <testFolder>
To delete a datacenter named myData:
run.bat com.vmware.samples.general.Delete --url <webserviceurl>
--username <username> --password <password> --meName <myData>
|
|
DeleteOneTime ScheduledTask.java |
Demonstrates how to delete a ScheduledTask (a OneTime scheduled task).
|
| Parameters: |
taskname Required. Name of the task to delete. |
Examples:
Delete a task named Task1:
run.bat com.vmware.samples.vm.DeleteOneTimeScheduledTask --url <webserviceurl>
--username <username> --password <password> --taskname <Task1>
|
|
DisplayNew Properties.java | Displays properties of the host according to the version of ESX Server or VirtualCenter Server.
For ESX 3.0
Server Name
For ESX 3.5
Boot Duration
Power State
Time Zone
|
| Parameters: | host Required. Name of the host. |
Examples:
To dispaly the properties of the host machine:
run.bat com.vmware.samples.version.DisplayNewProperties --url <webserviceurl>
--username <username> --password <password> --host <Name of the host>
|
|
| EventFormat.java |
Retrieves and formats the lastEvent from either Hostd or Vpxd
| | Parameters: | None |
Examples:
run.bat com.vmware.samples.vm.EventFormat --url <webserviceurl>
--username <username> --password <password>
|
|
EventHistory CollectorMonitor.java |
Standalone client application that demonstrates logging on to the Web service, creating an EventHistoryCollector, and then monitoring Events using the latestPage attribute of the EventHistoryCollector.
|
Examples:
run.bat com.vmware.samples.vm.EventHistoryCollectorMonitor --url <webserviceurl> --username <username> --password <password>
|
|
GetVirtual DiskFiles.java |
Searches the virtual disk files in all datastores on specified host using the ControllerType property (which is available only in VirtualCenter 2.5 and later release and ESX Server 3.5 and later systems.
|
| Parameters: |
host Required. Name of the host.
|
Examples:
run.bat com.vmware.samples.version.GetVirtualDiskFiles --url <webserviceurl> --username <username> --password <password> --host <host>
|
|
| GetVMFiles.java |
Retrieves all configuration files, snapshots files, log files, virtual disk files, and related virtual machine files and saves to the specified path on the local system.
| | Parameters: |
url Required. URL of the web service.
username Required. Account with privileges on the server.
Password Required. Password for user account.
vmname Required. Name of the virtual machine.
localpath Required. Localpath to copy files.
|
Examples:
To get the virtual machine files on local disk:
run.bat com.vmware.samples.httpfileaccess.GetVMFiles --url <webserviceurl>
--username <username> --password <password> --vmname <vmname> --localpath<localpath>
|
|
| GetUpdates.java |
Demonstrates how to use the PropertyCollector to monitor one or more properties of one or more managed objects. Monitors virtual machines and hosts for changes to some basic properties. |
| Parameters: |
vmname Required. Name of the virtual machine. |
Examples:
run.bat com.vmware.samples.general.GetUpdates --url <webserviceurl>
--username <username> --password <password> --vmname <vmName>
|
|
| History.java |
Reads performance measurements from the current time.
| | Parameters: |
url Required. URL of the web service.
username Required. User account for authentication.
password Required. Password the user account.
hostRequired. Name of the host (DNS or IP).
interval Required. Sampling interval.
starttime Optional. In minutes. Specify start time for data collection.
duration Optional. Duration for which samples needs to be taken
groupname Required. Cpu, memory
countername Required. Usage, overhead |
Examples:
To display performance measurements of extra CPU usage:
run.bat com.vmware.samples.performance.History --url <webserviceurl> --username <username> --password <password> --host <name of the history server> --groupname cpu --countername usage
To display performance-measurement history for the specified counter and group:
run.bat com.vmware.samples.performance.History --url <webserviceurl>
--username <username> --password <password> --host <name of the
history server> --groupname cpu --countername usage
| |
| LicenseManager.java |
Demonstrates using the LicenseManager.
| | Parameters: |
action Required. Action to be performed [<browse | setserver | setedition | featureinfo>]
serverurl Optional. URL of license server
edition Optional. Licensed edition.
feature Optional. Licensed feature. |
Examples:
To browse all licenses:
run.bat com.vmware.samples.general.LicenseManager --url <webserviceurl>
--username <username> --password <password> --action<browse>
To set the license edition:
run.bat com.vmware.samples.general.LicenseManager --url <webserviceurl>
--username <username> --password <password> --action<setedition> --edition <VMotion>
To retrieve license feature information:
run.bat com.vmware.samples.general.LicenseManager --url <webserviceurl>
--username <username> --password <password> --action<featureinfo> --feature <VMotion>
To set the licence source to the specified server:
run.bat com.vmware.samples.general.LicenseManager --url <webserviceurl>
--username <username> --password <password> --action<serserver> --serverurl <url>
|
|
| Move.java |
After locating the specified managed entity in its current folder in the inventory, moves the specified managed entity (such as a virtual machine)to a new location. If the managed entity or the folder is not found, displays an error message on the console.
| | Parameters: |
entityname Required. Name of the managed entity.
foldername Required. Name of the folder.
|
Examples:
To move a folder named Development into another folder named Production_Test:
run.bat com.vmware.samples.general.Move --url <webserviceurl> --username <username> --password <password> --entityname Development -- foldername Production_Test
To move a datacenter named LocalDatacenter into a folder named LocalAssets&148;:
run.bat com.vmware.samples.general.Move --url <webserviceurl>
--username <username> --password <password> --entityname LocalDatacenter
--foldername LocalAssets
|
|
| OneTimeScheduledTask.java |
Demonstrates using the ScheduledTaskManager to create a ScheduledTask.
| | Parameters: |
taskname Required. Name of the task to be scheduled.
vmname Required. Name of the virtual machine.
|
Examples:
run.bat com.vmware.samples.vm.OneTimeScheduledTask --url
<webserviceurl> --username <username> --password <password>
--taskname <myTask>
|
|
| PowerDownHostToStandBy.java |
Uses the new powerDownHostToStandBy operation (available through the API 2.5, on VirtualCenter 2.5, ESX Server 3.5, and ESX Server 3i systems) to power down the virtual machine. (Not supported on VirtualCenter 2.0.x or ESX Server 3.0.x systems). |
| Parameters: |
host Required. Name of the host system.
|
Examples:
run.bat com.vmware.samples.version.PowerDownHostToStandBy --url <webserviceurl>
--username <username> --password <password> --host <host>
|
|
| PrintCounters.java |
Creates a file of all available counters (for a specified managed entity)
at a specified location. The managed entity can be a host system, virtual machine, or a resource pool.
| | Parameters: |
entitytype Required. Type of managed entity [<HostSystem | VirtualMachine | ResourcePool>]
entityname Required. Name of the host system.
filename Required. Name of the file.
|
Examples:
To get the counter of a valid host:
run.bat com.vmware.samples.performance.PrintCounters --url <webserviceurl>
--username <username> --password <password> --entitytype <HostSystem> --entity name <Name of the host>
--filename <name of the file>
To get the counter of a valid virtual machine:
run.bat com.vmware.samples.performance.PrintCounters --url <webserviceurl>
--username <username> --password <password> --entitytype <VirtualMachine> --entity name <Name of the vm>
--filename <name of the file>
To get the counter of a valid resource pool:
run.bat com.vmware.samples.performance.PrintCounters --url <webserviceurl>
--username <username> --password <password> --entitytype <resource pool> --entity name <Name of the pool>
--filename <name of the file>
|
|
| PropertyCollector.java |
Demonstrates using a PropertyCollector to obtain information about various managed entities.
| | Parameters: |
dcName Required. Name of the datacenter.
vmDnsName Required. DNS name of a virtual machine. |
Examples:
run.bat com.vmware.samples.general.PropertyCollector --url <webserviceurl>
--username <username> --password <password> --dcName <datacenter>
--vmDnsName <vmDnsName>
|
|
| QueryMemoryOverhead.java |
Determines the amount of memory overhead necessary to power-on a virtual machine with the specified characteristics.
| | Parameters: |
host Required. Name of the host
memorysize Required. Size of the memory
cpucount Required. Number of the CPU count
|
Examples:
run.bat com.vmware.samples.version.QueryMemoryOverhead --url <webserviceurl>
--username <username> --password <password> --host <host>
--memorysize <memorysize> --cpucount <cpucount>
|
|
| Realtime.java |
Displays the performance measurements from the current time at the console.
| | Parameters: | vmname Required. Name of the virtual machine.
|
Examples:
run.bat com.vmware.samples.performance.Realtime --url <webserviceurl> --username <username> --password <password>
--vmname <vmName>
|
|
| RemoveManagedObject.java |
Unregister or destroy (remove from the inventory) specific managed entities, such as hosts, virtual machines, folders, and son on.
| | Parameters: |
objecttype Required. Type of managed object (managed entity HostSystem, VirtualMachine, Datacenter, ResourcePool, Folder, for example on which to perform the operation.
objectname Required. Name of the object instance.
operation Optional. Operation to perform [ remove | unregister ]
|
Examples:
To remove a folder named Production
run.bat com.vmware.samples.general.RemoveManagedObject --url <webserviceurl> --username <username> --password <password> --objtype <Folder> --objname <Production>
To unregister a virtual machine named VM1
run.bat com.vmware.samples.general.RemoveManagedObject --url <webserviceurl> --username <username> --password <password>
--objtype <VirtualMachine> --objname <VM1> --operation <unregister>
| |
| RemoveVirtualNic.java |
Remove a virtual NIC from a port group on a virtual machine.
| | Parameters: |
portgroup Required. Name of the port group from which to remove the virtual NIC (network interface card or controller).
host Optional. Name of the host.
datacenter Optional. Name of the datacenter.
|
Examples:
To remove a Host VirtualNic from a PortGroup:
run.bat com.vmware.samples.host.RemoveVirtualNic --url <webserviceurl> --username <username> --password <password>
--datacenter <mydatacenter> --portgroup <myportgroup>> --host <host>
To remove a Host VirtualNic from a PortGroup without specifying the host:
run.bat com.vmware.samples.host.RemoveVirtualNic --url <webserviceurl> --username <username> --password <password>
--datacenter <mydatacenter> --portgroup <myportgroup>
To remove a Host VirtualNic from a PortGroup without specifying the datacenter:
run.bat com.vmware.samples.host.RemoveVirtualNic --url <webserviceurl> --username <username> --password <password>
--portgroup <myportgroup> --host <name of the host>
|
|
| RemoveVirtualSwitch.java |
Remove a virtual switch from a host system or VirtualCenter Server system.
| | Parameters: |
vswitch Required. Name of the switch to be removed.
host Optional. Name of the host.
datacenter Optional. Name of the datacenter.
|
Examples:
To remove the virtual switch from the VirtualCenter Server:
run.bat com.vmware.samples.host.RemoveVirtualSwitch --url <webserviceurl> --username <username> --password *<password> --vswitch <mySwitch> --datacenter <mydatacenter> --host<host>
To remove a Virtual Switch from a virtual center without specifying the host:
run.bat com.vmware.samples.host.RemoveVirtualSwitch --url <webserviceurl> --username <username> --password *<password> --vswitch <mySwitch> --datacenter <mydatacenter>
To remove a Virtual Switch from a virtual center without specifying the datacenter:
run.bat com.vmware.samples.host.RemoveVirtualSwitch --url <webserviceurl> --username <username> --password <password> --vswitch <mySwitch> --host <host>
|
|
| RemoveVirtualSwitchPortGroup.java |
Removes specified portgroup from a virtual switch.
| | Parameters: |
portgroup Required. Name of the port group to be removed.
host Optional. Name of the host.
datacenter Optional. Name of the datacenter. |
Examples:
To remove a Virtual Switch Port Group:
run.bat com.vmware.samples.host.RemoveVirtualSwitchPortGroup --url <webserviceurl>
--username <username> --password <password>
--datacenter <mydatacenter> --portgroup <myportgroup> --host <host>
|
Examples:
To remove a Virtual Switch Port Group without specifying the host name:
run.bat com.vmware.samples.host.RemoveVirtualSwitchPortGroup --url <webserviceurl> --username <username> --password <password>
--datacenter <mydatacenter> --portgroup <myportgroup>
To remove a virtual switch port group without specifying the datacenter name:
run.bat com.vmware.samples.host.RemoveVirtualSwitchPortGroup --url <webserviceurl> --username <username> --password <password>
--portgroup <myportgroup> --host<host>
|
|
| Rename.java |
Renames the specified managed entity. |
| Parameters: |
entityname Required. Name of the managed entity.
newname Required. New name of the virtual machine entity.
|
Examples:
To rename a virtual machine VM to new name VM2:
run.bat com.vmware.samples.general.Rename --url <webserviceurl>
--username <username> --password <password> --entityname <VM>
-- newname <VM2>
To rename a resource pool named Rp to new name pool:
run.bat com.vmware.samples.general.Rename --url <webserviceurl>
--username <username> --password <password> --entityname <Rp>
-- newname <pool>
|
|
| SCSILunName.java |
Displays the CanonicalName, vendor, model, data, namespace, and NamespaceId of the host SCSI LUN name.
| | Parameters: | host Required. Name of the host.
|
Examples:
Displays the CanonicalName, Vendor, Model, Data, Namespace and NamespaceId of the host SCSI LUN name.
run.bat com.vmware.samples.scsilun.SCSILunName --url <webserviceurl>
--username <username> --password <password> --host <host>
| |
| SearchIndex.java |
Demonstrates using the SearchIndex.
| | Parameters: |
dcName Required. Name of the datacenter.
vmDnsName Optional. DNS (domain name system) name of the virtual machine.
hostDnsName Optional. DNS of the host machine.
vmPath Optional. Inventory path of the target virtual machine.
vmIP Optional. IP Address of a virtual machine.
|
Examples:
To find a specific datacenter using the SearchIndex:
run.bat com.vmware.samples.general.SearchIndex --url <webserviceurl>
--username <username> --password <password> --dcName <myDatacenter>
To run the search index giving the valid dcName myDatacenter and vmpath to a virtual machine named Test:
run.bat com.vmware.samples.general.SearchIndex --url <webserviceurl>
--username <username> --password <password> --dcName <myDatacenter>
--vmpath <"/Datacenter/vm/Test">
To run the search index giving the valid dcName myDatacenter and hostdnsname as 'abc.bcd.com':
run.bat com.vmware.samples.general.SearchIndex --url <webserviceurl>
--username <username> --password <password> --dcName <myDatacenter>
--hostDns <abc.bcd.com>
To run the search index giving the valid dcName myDatacenter and ip of the
vm as 111.123.155.21:
run.bat com.vmware.samples.general.SearchIndex --url <webserviceurl>
--username <username> --password <password> --dcName <myDatacenter>
--vmIP <111.123.155.21>
|
|
| SimpleClient.java |
Demonstrates connecting to server, logging in, retrieving ServiceContent managed object, display inventory contents, and logging out. |
| Parameters: | Web service URL, username, and password only.
webserviceurl Required. URL of the Web service.
username Required. Account with logon privileges.
password Required. Password for the logon account.
|
Examples:
run.bat com.vmware.samples.general.SimpleClient --url <webserviceurl>
--username <username> --password <password>
|
|
| TaskList.java |
Assuming that a task is running when this sample is run, the details of all tasks performed on the specified managed object are listed:
Operation:
Name:
Type:
State:
Error:
(If no tasks are running, a message to that effect is displayed.)
|
Examples:
run.bat com.vmware.samples.general.TaskList --url <webserviceurl>
--username <username> --password <password>
|
|
| VITop.java |
An ESX Top look-alike demonstrating VI Performance monitoring API.
| | Parameters: |
host Required. Name of the host.
memory Required. Counter for memory.
|
Examples:
run.bat com.vmware.samples.performance.VITop --url <webservice url> --username <user>
--password <password> --host <A Host Name> --cpu <counters of the cpu>
|
|
| VIUsage.java |
Graphical representation of the counters.
| | Parameters: |
host Required. Name of the host.
counter Required. Type of performance counter. For example, <group.counter.rollup> cpu.usage.none
|
Examples:
run.bat com.vmware.samples.performance.VIUsage --url <webserviceurl>
--username <username> --password <password> --host <host name> --counter
<Type of Counter {group.counter.rollup}>
|
|
| VMClone.java |
Locates a pre-existing virtual machine on the VirtualCenter server. Makes a template from this virtual machine for future use. Deploys n instances of this template onto a datacenter.
| | Parameters: |
datacenter Required. Name of the datacenter supporting the virtual machine.
vmpath Required. Path to the virtual machine (in the inventory, represented using dot-notation, as in parent.child1.child2).
clonename Required. Name to use to identify the clone. |
Examples:
To clone a virtual machine:
run.bat com.vmware.samples.vm.VMClone --url <webserviceurl>
--username <username> --password <password> --Datacenter <Datacenter>
--vmPath <vmPath> --CloneName <CloneName>
|
|
| VMCreate.java |
Creates a virtual machine on the specified target datacenter.
| | Parameters: | vmname : Required. Name of the virtual machine.
datacenter Required. Name of the datacenter.
host : Optional. Name of the host.
guestosid: Optional. Type of Guest OS.
cpucount: Optional. Total cpu count.
disksize Optional. Size of the Disk.
memorysize Optional. Size of the Memory in the blocks of 1024 MB.
datastorename Optional. Name of datastore.
|
Examples:
To create a virtual machine on the specified datacenter and host:
run.bat com.vmware.samples.vm.VMCreate --url <webserviceurl>
--username <username> --password <password> --vmname <vmname>
--datacenter <datacenter>
--host <host>
To create a virtual machine when the name of the vmname,datacenter name and name of the guestosid is provided:
run.bat com.vmware.samples.vm.VMCreate --url <webserviceurl> --username <username> --password <password> --vmname <vmname> --datacenter <datacenter> --guestosid <guestosid>
To create a virtual machine when the name of the vmname, datacenter name and cpucount parameter value is provided:
run.bat com.vmware.samples.vm.VMCreate --url <webserviceurl> --username <username> --password <password> --vmname <vmname> --datacenter <datacenter> --cpucount <cpucount>
|
|
| VMEventHistoryCollectorMonitor.java |
Demonstrates logging on to the Web service, creating an EventHistoryCollector using a filter comprising a single virtual machine, and monitoring events using the EventHistoryCollectors latestPage attribute.
|
| Parameters: |
vmpath Required. A virtual machine inventory path.
|
Examples:
run.bat com.vmware.samples.vm.VMEventHistoryCollectorMonitor --url <webserviceurl>
--username <username> --password <password> --vmPath <vm inventory Path>
| |
| VMpowerOps.java |
Performs power operations on the specified virtual machines.
| | Parameters: |
vmname Optional. Name of the virtual machine
operation Optional. Type of the operation
folder Optional. Name of the folder
datacenter Optional. Name of the datacenter
pool Optional. Name of the resource pool
ipaddress Optional. ipaddress of the virtual machine
guestid Optional. guestid of the virtual machine
host Optional. Name of the host
operation Optional. Name of the operation.
|
Examples:
run.bat com.vmware.samples.vm.VMpowerOps --url <webserviceurl> --username <username> --password <password>
--operation <operation name reboot|poweron|poweroff|reset|standby|suspend|shutdown> --folder <myfolder>
--guestid <winXPProGuest|any other> --datacenter <mydatacenter>
|
|
| VMPowerStateAlarm.java |
Creates an alarm that monitors the power state of the specified virtual machine.
| | Parameters: |
vmname Required. Name of the virtual machine.
alarm Required. Name of the alarms. |
Examples:
To create an alarm power_state_change on a virtual machine:
run.bat com.vmware.samples.vm.VMPowerStateAlarm --url <webserviceurl>
--username <username> --password <password> --vmname <vmname>
--alarm <power_state_change>
|
|
| VMReconfig.java |
Reconfigures a virtual machine, including reconfiguring
the disk size,disk mode, and other details.
| | Parameters: |
vmname Required. Name of the virtual machine.
device Required. Must be one of [ cpu | memory | disk | cd | nic ].
operation Optional. [ add | remove ]
value Required. [ high | low | normal | numeric value ]
disksize Optional. Size of virtual disk.
diskmode Optional. [ persistent | [independent_persistent | independent_nonpersistent] ]
To configure a virtual machine, for example, to change CPU shares to 100:
run.bat com.vmware.samples.vm.VMReconfig --url <webserviceurl>
--username <username> --password <password> --vmname <vmname> --device <device>
--operation <operation> --value <value> --disksize <disksize> --diskmode <diskmode>
|
Examples:
To configure a virtual machine to add a 100-GB hard disk named HardDiskA:
run.bat com.vmware.samples.vm.VMReconfig --url <webserviceurl> --username <username> --password <password> --vmname <vmname> --device <disk> --operation <add> --value <A> --disksize <100>
To delete a NIC (network interface card) from a virtual machine:
run.bat com.vmware.samples.vm.VMReconfig --url <webserviceurl>
--username <username> --password <password> --vmname <vmname> --device <nic>
--operation <remove> --value <name of the nic>
|
|
| VMSnapshot.java |
Demonstrates virtual machine snapshot operations. |
|
Parameters: |
vmname Required. Name of the virtual machine.
operation Required. Type of the operation
snapshotname Optional. Name of the snapshot
description Optional. Description of the sanpshot
removechild Optional. Used only if children need to be removed; 0 if children do not need to be removed. |
Examples:
To list the name of the snapshot:
run.bat com.vmware.samples.vm.VMSnapshot --url <webserviceurl> --username <username> --password <password> --vmname <vmname> --operation <list>
To create a snapshot of the virtual machine:
run.bat com.vmware.samples.vm.VMSnapshot --url <webserviceurl> --username <username> --password <password> --vmname <vmname> --operation <create> --description <Description of the snapshot>
To revert a snapshot of the virtual machine:
run.bat com.vmware.samples.vm.VMSnapshot --url <webserviceurl> --username <username> --password <password> --vmname <vmname> --operation <revert> --description <Description of the snapshot>
To remove a snapshot of the virtual machine:
run.bat com.vmware.samples.vm.VMSnapshot --url <webserviceurl> --username <username> --password <password> --vmname <vmname> --operation <remove> --removechild <0>
|
|
WeeklyRecurrence ScheduledTask.java |
Demonstrates using the ScheduledTaskManager to create a ScheduledTask.
| | Parameters: |
taskname Required. Name of the task to be scheduled.
vmpath Required. Path to the virtual machine in the inventory. |
Examples:
run.bat com.vmware.samples.vm.WeeklyRecurrenceScheduledTask --url <webserviceurl> --username <username> --password <password> --vmpath </Datacenter/vm/my_production_folder/my_Win2k_vm> --taskname <Task1>
|
|
Copyright © 2007, 2008 VMware, Inc. All rights not expressly granted herein
are reserved.