All Classes Interface Summary Class Summary Exception Summary
| Class |
Description |
| AcquireSessionInfo |
AcquireSessionInfo
This sample will acquire a session with VC or ESX
and print a cim service ticket and related
session information to a file
Parameters:
url [required] : url of the web service
username [required] : username for the authentication
password [required] : password for the authentication
host [required] : Name of the host
info [optional] : Type of info required
only [cimticket] for now
file [optional] : Full path of the file to save data to
Command Line:
run.bat com.vmware.general.Browser --url [webserviceurl]
--username [username] --password [password]
--host [hostname] --info [password] --file [path_to_file]
|
| AddVirtualNic |
AddVirtualNic
This sample is used to add a Virtual Nic to a PortGroup or a DVPortGroup
Parameters:
url [required] : url of the web service
username [required] : username for the authentication
password [required] : password for the authentication
portgroupname [required] : Name of the port group
ipaddress [optional] : ipaddress for the nic, if not set DHCP
will be in affect for the nic
hostname [required] : Name of the host
Command Line:
Add VirtualNic to a PortGroup on a Virtual Switch
run.bat com.vmware.host.AddVirtualNic --url [webserviceurl]
--username [username] --password [password]
--hostname [hostname]
--portgroupname [myportgroup] --ipaddress [AAA.AAA.AAA.AAA]
|
| AddVirtualSwitch |
AddVirtualSwitch
This sample is used to add a virtual switch
Parameters:
url [required] : url of the web service
username [required] : username for the authentication
password [required] : password for the authentication
vswitchid [required]: Name of the switch to be added
hostname [required]: Name of the host
Command Line:
Add a Virtual Switch
run.bat com.vmware.host.AddVirtualSwitch --url [webserviceurl]
--username [username] --password [password] --hostname [hostname]
--vswitchid [mySwitch]
|
| AddVirtualSwitchPortGroup |
AddVirtualSwitchPortGroup
This sample is used to add a Virtual Machine Port Group to a vSwitch
Parameters:
url [required] : url of the web service
username [required] : username for the authentication
password [required] : password for the authentication
vswitchid [required] : Name of the vSwitch to add portgroup to
portgroupname [required] : Name of the port group
hostname [optional] : Name of the host
Command Line:
Add Virtual switch Port Group:
run.bat com.vmware.host.AddVirtualSwitchPortGroup
--url [webserviceurl] --username [username] --password [password]
--vswitchid [mySwitch] --portgroupname [myportgroup] --hostname [hostname]
|
| ApiValidator |
Some samples make use of API only found on vCenter.
|
| BaseHelper |
|
| BasicConnection |
This simple object shows how to set up a vSphere connection as it was done in vSphere 4.x and is provided
as a reference for anyone working with older vSphere servers that do not support modern SSO features.
|
| Basics |
Basics
This sample displays available performance counters or other data
for an requested ESX system.
|
| Browser |
Browser
This sample prints managed entity, its type, reference value,
property name, Property Value, Inner Object Type, its Inner Reference Value
and inner property value
Parameters:
url [required] : url of the web service
username [required] : username for the authentication
password [required] : password for the authentication
Command Line:
run.bat com.vmware.general.Browser --url [webserviceurl]
--username [username] --password [password]
|
| CIMReader |
examples of how to work with CIM and vSphere API together.
|
| Connect |
Connect
This sample simply connects to an ESX server or to vCenter server
Parameters:
url [required] : url of the web service
username [required] : username for the authentication
password [required] : password for the authentication
Command Line:
run.bat com.vmware.general.Connect --url [webserviceurl]
--username [username] --password [password]
|
| ConnectedVimServiceBase |
An abstract base class, extend this class if your common needs to
open a connection to the virtual center server before it can do anything useful.
|
| Connection |
This simple object shows how to set up a vCenter connection.
|
| ConnectionException |
ConnectionException is the base exception thrown by connection classes,
making this a runtime exception means that catching it is optional preventing clutter,
basing all connection related exceptions on this class means
that you may decide to catch ConnectionException to deal with any issues underneath
the connection infrastructure.
|
| ConnectionFactory |
Holds the logic for how to construct a connection class.
|
| ConnectionMalformedUrlException |
|
| Create |
Create
This sample creates managed entity like Host-Standalone Cluster
Datacenter, and folder
Parameters:
url [required] : url of the web service
username [required] : username for the authentication
password [required] : password for the authentication
parentname [required] : specifies the name of the parent folder
itemtype [required] : Type of the object to be added
e.g.
|
| CreateStorageDRS |
This sample demonstrates how to create Storage DRS
Parameters:
url [required]: url of the web service.
|
| CreateTemporaryFile |
CreateTemporaryFile
This sample creates a temporary file inside a virtual machine.
|
| CreateUser |
CreateUser
The CreateUser class creates a user account and password stores them the local credential store.
|
| CredentialStore |
A credential store.
|
| CredentialStoreAdmin |
********************************************************************************
The CredentialStoreAdmin class is a command-line tool that provides complete
access to the credential store backing file on the local machine.
|
| CredentialStoreCipher |
This class uses the JVM provided classes in javax.crypto.* to encrypt and decrypt
text.
|
| CredentialStoreFactory |
Factory class providing instances of a {linkplain CredentialStore credential
store}.
|
| Delete |
Delete
This sample deletes the specified managed entity from the inventory tree
The managed entity can be a virtual machine, ClusterComputeResource or a Folder
Parameters
url [required] : url of the web service
username [required] : username for the authentication
password [required] : password for the authentication
entityname [required] : Virtual Machine|ClusterComputeResource|Folder
Command Line:
To delete a folder named 'testFolder'
run.bat com.vmware.general.Delete --url [webserviceurl]
--username [username] --password [password] --entityname [testFolder]
To delete a datacenter named myData
run.bat com.vmware.general.Delete --url [webserviceurl]
--username [username] --password [password] --entityname [myData]
|
| DeleteOneTimeScheduledTask |
DeleteOneTimeScheduledTask
This sample demonstrates deleting a scheduled task
Parameters:
url [required] : url of the web service
username [required] : username for the authentication
password [required] : password for the authentication
taskname [required] : name of the task to be deleted
Command Line:
run.bat com.vmware.scheduling.DeleteOneTimeScheduledTask
--url [webserviceurl] --username [username] --password [password]
--taskname [TaskToBeDeleted]
|
| DownloadGuestFile |
DownloadGuestFile
This sample downloads a file from the guest to a specified
path on the host where the client is running.
|
| DVSCreate |
This sample demonstrates how to create/update Distributed Virtual Switch
Parameters:
url [required]: url of the web service.
|
| ESXHostSampleBase |
Some API samples only make sense when used with an ESX(i) Host
Samples based on this class will only function when connected
to an ESX/ESXi host.
|
| EventFormat |
EventFormat
This sample retrieves and formats the lastEvent from Hostd or Vpxd
Parameters:
url [required] : url of the web service.
|
| EventHistoryCollectorMonitor |
EventHistoryCollectorMonitor
This sample demonstrates how to create and monitor an EventHistoryCollector
This sample uses the latestPage property of the EventHistoryCollector
to filter the Events
Parameters:
url [required] : url of the web service
username [required] : username for the authentication
password [required] : password for the authentication
Command Line:
run.bat com.vmware.vm.EventHistoryCollectorMonitor
--url [webserviceurl] --username [username] --password [password]
|
| FcdAttachToVM |
FcdAttachToVM
This sample attaches a given virtual storage object to the given virtual
machine.
|
| FcdClone |
FcdClone
This sample clones a virtual storage object.
|
| FcdCreate |
FcdCreate
This sample creates a virtual storage object
Parameters:
url [required] : url of the web service
username [required] : username for the authentication
password [required] : password for the authentication
vstorageobjectname [required] : Name of the disk
datastorename [required] : Name of the datastore
vstorageobjectsizeinMB [required] : Size of the disk(in MB)
provisioningtype [optional] : Type of provisioning for the disk
[thin | eagerZeroedThick |
lazyZeroedThick | virtualMode |
physicalMode]
devicename [optional] : Canonical name of the LUN to use for disk types
Command Line:
Create a disk (virtual storage object) given vstorageobject name, datastore
name and vstorageobject size
run.bat com.vmware.vm.FcdCreate --url [webserviceurl]
--username [username] --password [password]
--vstorageobjectname [vstorageobjectname] --datastorename [datastorename]
--vstorageobject [vstorageobject]
Create a disk (virtual storage object) given vstorageobject name, datastore
names, vstorageobject size and provisioning type of vstorageobject
run.bat com.vmware.vm.FcdCreate --url [webserviceurl]
--username [username] --password [password]
--vstorageobjectname [vstorageobjectname] --datastorename [datastorename]
--vstorageobject [vstorageobject] --provisioningtype [provisioningtype]
--devicename [devicename]
Ex: devicename :: vmhba0:0:0:0
|
| FcdDelete |
FcdDelete
This sample deletes a given virtual storage object.
|
| FcdDetachFromVM |
FcdDetachFromVM
This sample detaches a given virtual storage object from the given virtual
machine.
|
| FcdExtend |
FcdExtend
This sample extends a virtual storage object capacity
Parameters:
url [required] : url of the web service
username [required] : username for the authentication
password [required] : password for the authentication
vStorageObjectId [required] : Id of the disk
datastorename [required] : Name of the datastore
newCapacityInMB [required] : The new capacity of the virtual disk in MB.
|
| FcdHelper |
Helper class for FCD Samples
|
| FcdInflateDisk |
FcdDelete
This sample inflates a sparse or thin-provisioned virtual disk up to the full size.
|
| FcdRegisterLegacyDisk |
FcdRegisterLegacyDisk
This sample registers a given legacy disk as First class disk.
|
| FcdRelocate |
FcdRelocate
This sample relocates a virtual storage object.
|
| FcdRename |
FcdRename
This sample renames a given virtual storage object.
|
| GetCim |
provides helper functions for getting objects needed to work with CIM related services from the initial vSphere
connection.
|
| GetCim.PasswordCredential |
The default PasswordCredential will prevent us from using sessionId's that
can be over 16 characters in length.
|
| GetCurrentTime |
GetCurrentTime
This sample gets the current time of the vSphere Server
Parameters:
url [required] : url of the web service
username [required] : username for the authentication
password [required] : password for the authentication
Command Line:
run.bat com.vmware.general.GetCurrentTime
--url [webservicesurl] --username [Username] --password [password]
|
| GetHost |
This class shows how to get a ManagedObjectReference to a host using its name or IP address.
|
| GetHostName |
GetHostName
This sample gets the hostname and additional details of the ESX Servers
in the inventory
Parameters:
url [required] : url of the web service
username [required] : username for the authentication
password [required] : password for the authentication
Command Line:
run.bat com.vmware.general.GetHostName
--url [webservicesurl] --username [username] --password [password]
|
| GetMOREF |
|
| GetUpdates |
GetUpdates
This sample demonstrates how to use the PropertyCollector to monitor one or more
properties of one or more managed objects.
|
| GetVMFiles |
GetVMFiles
This sample gets all the config files, snapshots files,
logs files, virtual disk files to the local system.
|
| GuestConnection |
vSphere API 5.0 is the first version to understand Guest connections.
|
| HCIBatchAddHostAndExtendCluster |
HCIBatchAddHostAndExtendCluster
This file includes sample codes for calling
batchAddHost HCI API to add new hosts to cluster.
|
| HCIComputeOnlyCluster |
HCIComputeOnlyCluster
This file includes sample codes for calling
config HCI API with simple config.
|
| History |
History
This sample reads performance measurements from the current time.
|
| HostProfileManager |
This sample demonstrates HostProfileManager and ProfileComplainceManager
Parameters:
url [required] : url of the web service
username [required] : username for the authentication
password [required] : password for the authentication
sourcehostname [required] : Name of the host
entityname [required] : Attached Entity Name
entitytype [required] : Attached Entity Type
Command Line:
Create hostprofile given profileSourceHost (host system)
profileAttachEntity (host system), profileAttachEntityType (host system)
Applies config after attaching hostprofile to host system and check for compliance");
run.bat com.vmware.host.HostProfileManager --url [webserviceurl]");
--username [username] --password [password] --sourcehostname [host name]
--entityname [host name] --entitytype HostSystem
Create hostprofile given profileSourceHost (host system),
profileAttachEntity (cluster computer resource), profileAttachEntityType
(cluster compute resource)
Attaches hostprofile to all hosts in cluster and checks for compliance
run.bat com.vmware.host.HostProfileManager --url [webserviceurl]
--username [username] --password [password] --sourcehostname [host name]
--entityname [Cluster] --entitytype ClusterComputeResource
|
| Info |
Demonstrates how to use the AboutInfo object to find out more about the
vSphere WS API end-point you are currently connected to.
|
| KeepAlive |
This is a keep-alive utility class.
|
| LicenseManager |
LicenseManager
Demonstrates uses of the Licensing API using License Manager
Reference.
|
| LineChart |
Draws a nice pretty chart given a set of data.
|
| Move |
Move
This sample moves a managed entity from its current
location in the inventory to a new location, in a specified folder.
|
| NIOCForDVS |
This sample demonstrates how to add/modify NetworkResourcePool to Distributed
Virtual Switch:
Parameters:
url [required]: url of the web service.
|
| ObjectSpecBuilder |
|
| OneTimeScheduledTask |
OneTimeScheduledTask
This sample demonstrates creation of ScheduledTask using the ScheduledTaskManager
Parameters:
url [required] : url of the web service.
|
| OVFManagerExportVAPP |
OVFManagerExportVAPP
This sample demonstrates OVFManager.
|
| OVFManagerExportVMDK |
OVFManagerExportVMDK
This is a demonstrates OVFManager.Exports VMDK's of a VM to the localSystem.
|
| OVFManagerImportLocalVApp |
OVFManagerImportLocalVApp
This class can be used import or deploy an OVF Appliance from the Local drive.
|
| OVFManagerImportVAppFromUrl |
This class can be used import or deploy an OVF Appliance from the specified URL.
|
| PrintCounters |
PrintCounters
This sample writes available VM, Hostsystem or ResourcePool
perf counters into the file specified
Parameters:
url [required] : url of the web service
username [required] : username for the authentication
password [required] : password for the authentication
entitytype [required] : Managed entity
[HostSystem|VirtualMachine|ResourcePool]
entityname [required] : name of the managed entity
filename [required] : Full path of filename to write to
Command Line:
Save counters available for a host
run.bat com.vmware.performance.PrintCounters
--url https://myHost.com/sdk
--username [user] --password [password] --entitytype HostSystem
--entityname myHost.com --filename myHostCounters
|
| PropertyCollector |
PropertyCollector
This sample illustrates the property collector features added in version 4.1
Parameters:
url [required] : url of the web service.");
username [required] : username for the authentication");
password [required] : password for the authentication");
extension [required] : Extension to be demonstrated [retrieveproperties |
updates | filterspec | propertycollector]
vmname [optional] : Name of the virtual machine
maxobjects [optional] : The maximum number of ObjectContent data objects
that should be returned in a single result
updatetype [optional] : waitforupdates | checkforupdates| extension
nooftasks [optional] : Number of tasks to be created
Command Line:
Retrieve Properties Extension
run.bat com.vmware.general.PropertyCollector --url [webserviceurl]
--username [username] --password [password] --extension retrieveproperties
--maxobjects [maxobjects]
Updates Extension
run.bat com.vmware.general.PropertyCollector --url [webserviceurl]
--username [username] --password [password] --extension updates
--vmname [vm name] --updatetype [waitforupdates | checkforupdates| extension]
Filter Spec Extension
run.bat com.vmware.general.PropertyCollector --url [webserviceurl]
--username [username] --password [password] --extension filterspec
--vmname [vm name] --noofTasks [Number of tasks to be created]
Property Collector Extension
run.bat com.vmware.general.PropertyCollector --url [webserviceurl]
--username [username] --password [password] --extension propertycollector
|
| PropertyFilterSpecBuilder |
|
| PropertySpecBuilder |
a simple builder that creates a property spec
|
| PutVMFiles |
PutVMFiles
This sample puts VM files in specified Datacenter and
Datastore and register and reconfigure the particular VM
Parameters:
url [required]: url of the web service.
|
| RealTime |
RealTime
This sample displays performance measurements from the current time
at the console
Parameters:
url [required] : url of the web service
username [required] : username for the authentication
password [required] : password for the authentication
vmname [required] : name of the vm
Command Line:
run.bat com.vmware.performance.RealTime
--url [webservice url] --username [user] --password [password]
--vmname [name of the vm]
|
| RemoveManagedObject |
This sample demonstrates Destroy or Unregister
Managed Inventory Object like a Host, VM, Folder, etc
Parameters:
url [required] : url of the web service
username [required] : username for the authentication
password [required] : password for the authentication
objtype [required] : type of managedobject to remove or unregister");
e.g.
|
| RemoveVirtualNic |
RemoveVirtualNic
This sample removes a Virtual Nic from a PortGroup on a vSwitch
Parameters:
url [required] : url of the web service
username [required] : username for the authentication
password [required] : password for the authentication
portgroupname [required] : Name of port group to remove Virtual Nic from
hostname [required] : Name of host
datacentername [optional] : Name of datacenter
Command Line:
Remove a VirtualNic from a PortGroup
run.bat com.vmware.host.RemoveVirtualNic --url [webserviceurl]
--username [username] --password [password] --datacentername [mydatacenter]
--portgroupname [myportgroup] --hostname [hostname]
Remove a VirtualNic from a PortGroup without hostname
run.bat com.vmware.host.RemoveVirtualNic --url [webserviceurl]
--username [username] --password [password] --datacentername [mydatacenter]
--portgroupname [myportgroup]
Remove a VirtualNic from a PortGroup without datacentername
run.bat com.vmware.host.RemoveVirtualNic --url [webserviceurl]
--username [username] --password [password]
--portgroupname [myportgroup] --hostname [name of the host]
|
| RemoveVirtualSwitch |
RemoveVirtualSwitch
This sample removes a virtual switch
Parameters:
url [required] : url of the web service
username [required] : username for the authentication
password [required] : password for the authentication
vswitchid [required] : Name of the switch to be added
hostname [required] : Name of the host
Command Line:
Remove a Virtual Switch
run.bat com.vmware.host.RemoveVirtualSwitch --url [webserviceurl]
--username [username] --password [password]
--vswitchid [mySwitch] --hostname [hostname]
|
| RemoveVirtualSwitchPortGroup |
RemoveVirtualSwitchPortGroup
This sample removes a Virtual Switch PortGroup
Parameters:
url [required] : url of the web service
username [required] : username for the authentication
password [required] : password for the authentication
portgroupname [required] : Name of the port group to be removed
hostname [required] : Name of the host
Command Line:
Remove Virtual Switch Port Group
run.bat com.vmware.host.RemoveVirtualSwitchPortGroup
--url [webserviceurl] --username [username] --password [password]
--portgroupname[myportgroup] --hostname [hostname]
|
| Rename |
Rename
This sample demonstrates renaming a manged entity
Parameters:
url [required] : url of the web service
username [required] : username for the authentication
password [required] : password for the authentication
entityname [required] : name of the inventory object - a managed entity
newname [required] : new name of the inventory object - a managed entity
Command Line:
Rename a virtual machine VM to new name VM2
run.bat com.vmware.general --url [webserviceurl]
--username [username] --password [password] --entityname VM
--newname VM2
Rename a resource pool named Rp to new name pool
java com.vmware.general --url [webserviceurl]
--username [username] --password [password] --entityname Rp
--newname pool
|
| RunProgram |
RunProgram
This sample runs a specified program inside a virtual machine with
output re-directed to a temporary file inside the guest and
downloads the output file.
|
| SCSILunName |
SCSILunName
This sample displays the CanonicalName,Vendor,Model,Data,Namespace
and NamespaceId of the host SCSI LUN name
Parameters:
url [required] : url of the web service
username [required] : username for the authentication
password [required] : password for the authentication
hostname [required] : host for which SCSI details will be displayed
Command Line:
run.bat com.vmware.scsilun.SCSILunName
--url [webserviceurl] --username [username] --password [password]
--hostname [host name]
|
| SDRSRecommendation |
This sample demonstrates how to Run the Storage DRS on a given SDRS cluster and show
the list of recommendations generated by SDRS.
|
| SDRSRules |
This sample demonstrates how to Add/List/Modify/Delete the rules for an
existing SDRS cluster.
|
| SearchIndex |
SearchIndex
This sample demonstrates the SearchIndex API
Parameters:
url [required] : url of the web service
username [required] : username for the authentication
password [required] : password for the authentication
dcname [required] : name of the datacenter
vmdnsname [optional] : Dns of a virtual machine
hostdnsname [optional] : Dns of the ESX host
vmpath [optional] : Inventory path of a virtual machine
vmip [optional] : IP Address of a virtual machine
Command Line:
Run the search index with dcName myDatacenter
run.bat com.vmware.general.SearchIndex --url [webserviceurl]
--username [username] --password [password] --dcName myDatacenter
Run the search index with dcName myDatacenter and vmpath to virtual machine named Test
run.bat com.vmware.general.SearchIndex --url [webserviceurl]
--username [username] --password [password] --dcName myDatacenter
--vmpath //DatacenterName//vm//Test
Run the search index with dcName myDatacenter and hostdns 'abc.bcd.com'
run.bat com.vmware.general.SearchIndex --url [webserviceurl]
--username [username] --password [password]
--dcName myDatacenter --hostDns abc.bcd.com
Run the search index with dcName myDatacenter and ip of the vm as 111.123.155.21
run.bat com.vmware.general.SearchIndex --url [webserviceurl]
--username [username] --password [password]
--dcName myDatacenter --vmIP 111.123.155.21
|
| SelectionSpecBuilder |
|
| SimpleAgent |
SimpleAgent
The SimpleAgent class uses the local credential store to obtain user account
and password information, for automated logon to the target host system.
|
| SimpleClient |
SimpleClient
This sample lists the inventory contents (managed entities)
Parameters:
url [required] : url of the web service
username [required] : username for the authentication
password [required] : password for the authentication
Command Line:
run.bat com.vmware.general.SimpleClient
--url [webserviceurl] --username [username] --password [password]
|
| SsoConnection |
Demonstrates SSO with vCenter's SSO service.
|
| StatsTable |
The Class StatsTable.
|
| TaskList |
TaskList
This sample prints out a list of tasks if any are running
The sample display the tasks in the following format:
Operation:
Name:
Type:
State:
Error:
Parameters:
url [required] : url of the web service
username [required] : username for the authentication
password [required] : password for the authentication
Command Line:
run.bat com.vmware.general.TaskList --url [webserviceurl]
--username [username] --password [password]
|
| TraversalSpecBuilder |
|
| UploadGuestFile |
UploadGuestFile
This sample uploads a file from the client machine to a
specified location inside the guest.
|
| VCenterSampleBase |
Some samples must use a VCenter to make any sense.
|
| VITop |
VITop
This sample is an ESX-Top-like application that lets administrators specify
the CPU and memory counters by name to obtain metrics for a specified host
Parameters:
url [required] : url of the web service
username [required] : username for the authentication
password [required] : password for the authentication
host [required] : name of the host
cpu [required] : CPU counter name
e.g.
|
| VIUsage |
VIUsage
This sample creates a GUI for graphical representation of the counters
Parameters:
url [required] : url of the web service
username [required] : username for the authentication
password [required] : password for the authentication
host [required] : Name of the host
counter [required] : Full counter name in dotted notation
(group.counter.rollup)
e.g.
|
| VMApplyEvc |
VMApplyEvc
This sample makes applies a Per-VM EVC setting to an existing VM.
|
| VMClone |
VMClone
This sample makes a template of an existing VM , change target network
deploy multiple instances of this template onto a datacenter
Parameters:
url [required] : url of the web service
username [required] : username for the authentication
password [required] : password for the authentication
datacentername [required] : name of Datacenter
vmpath [required] : inventory path of the VM
clonename [required] : name of the clone
hostname [optional] : name of the host
targetnetworkname [optional] : name of the target network
Command Line:
java com.vmware.vm.VMClone --url [webserviceurl]
--username [username] --password [password]
--datacentername [DatacenterName]"
--vmpath [vmPath] --clonename [CloneName] --host [hostname]
--targetnetworkname [Target Network Name]
|
| VMCreate |
VMCreate
This sample creates a VM
Parameters:
url [required] : url of the web service
username [required] : username for the authentication
password [required] : password for the authentication
vmname [required] : Name of the virtual machine
datacentername [required] : Name of the datacenter
hostname [required] : Name of the host
networkname [required] : Network Name
(Types can be Standard/Distributed/Opaque)
guestosid [optional] : Type of Guest OS
cpucount [optional] : Total cpu count
disksize [optional] : Size of the Disk
memorysize [optional] : Size of the Memory in 1024MB blocks
datastorename [optional] : Name of dataStore
Command Line:
Create a VM given datacenter and host names
run.bat com.vmware.vm.VMCreate --url [webserviceurl]
--username [username] --password [password] --vmname [vmname]
--datacentername [DataCenterName] --hostname [hostname] --networkname [networkname]
Create a VM given its name, Datacenter name and GuestOsId
run.bat com.vmware.vm.VMCreate --url [webserviceurl]
--username [username] --password [password] --vmname [vmname]
--datacentername [DataCenterName] --guestosid [GuestOsId]
Create a VM given its name, Datacenter name and its cpucount
run.bat com.vmware.vm.VMCreate --url [webserviceurl]
--username [username] --password [password] --vmname [vmname]
--datacentername [DataCenterName] --cpucount [cpucount]
|
| VMDeltaDisk |
VMDeltaDisk
This sample creates a delta disk on top of an existing virtual disk in a VM,
and simultaneously removes the original disk using the reconfigure API.
|
| VMDiskCreate |
VMDiskCreate
This sample demonstrates how to create a virtual disk
Parameters:
url [required] : url of the web service
username [required] : username for the authentication
password [required] : password for the authentication
vmname [required] : Name of the virtual machine
datastorename [optional] : name of the DataStore
disksize [required] : Size of the virtual disk in MB
disktype [optional] : Virtual Disk Type
[thin | preallocated | eagerzeroed | rdm | rdmp]
persistence [optional] : Persistence mode of the virtual disk
[persistent | independent_persistent | independent_nonpersistent]
devicename [optional] : Canonical name of the LUN to use for disk types
Command Line:
VMDiskCreate --url [webserviceurl]
--username [username] --password [password]
--vmname [vmname] --disksize [8]
--disktype [thin | preallocated | eagerzeroed | rdm | rdmp]
--persistence [persistent | independent_persistent | independent_nonpersistent]
--devicename vmhba0:0:0:0
|
| VMEventHistoryCollectorMonitor |
VMEventHistoryCollectorMonitor
This sample is responsible for creating EventHistoryCollector
filtered for a single VM and monitoring Events using the
latestPage attribute of the EventHistoryCollector.
|
| VMLinkedClone |
VMLinkedClone
This sample creates a linked clone from an existing snapshot
Each independent disk needs a DiskLocator with
diskmovetype as moveAllDiskBackingsAndDisallowSharing
Parameters:
url [required] : url of the web service
username [required] : username for the authentication
password [required] : password for the authentication
vmname [required] : Name of the virtual machine
snapshotname [required] : Name of the snapshot
clonename [required] : Name of the cloneName
Command Line:
Create a linked clone
run.bat com.vmware.vm.VMLinkedClone --url [webserviceurl]
--username [username] --password [password] --vmname [myVM]
--snapshotname [snapshot name] --clonename [clone name]
|
| VMManageCD |
VMManageCD
This sample adds / removes CDROM to / from an existing VM
This sample lists information about a VMs CDROMs
This sample updates an existing CDROM a VM
Parameters:
url [required] : url of the web service
username [required] : username for the authentication
password [required] : password for the authentication
vmname [required] : name of the virtual machine
operation [required] : operation type - [get|add|remove|set]
isopath [optional] : full datastore path to the iso file
remote [optional] : Specify the device is a remote or client device or iso
startconnected [optional] : virtual CD starts connected when VM powers on
connect [optional] : virtual CD is connected after creation or update
Set only if VM is powered on
label [optional] : used to find the device.key value
devicename [optional] : Specify the path to the CD on the VM's host
Command Line:
Get CD-Rom Info");
run.bat com.vmware.vm.VMManageCD
--url [webserviceurl] --username [username] --password [password]
--operation get --vmname [Virtual Machine Name]
Add CD-Rom
run.bat com.vmware.vm.VMManageCD
--url [webserviceurl] --username [username] --password [password]
--operation add --vmname [Virtual Machine Name]
--isoPath "[datastore1] test.iso" --remote false --connect true
Remove CD-Rom
run.bat com.vmware.vm.VMManageCD
--url [webserviceurl] --username [username] --password [password]
--operation remove --vmname [Virtual Machine Name]
--label CD\\DVD Drive 1
Reconfigure CD-Rom
run.bat com.vmware.vm.VMManageCD
--url [webserviceurl] --username [username] --password [password]
--operation set --vmname [Virtual Machine Name]
--label CD\\DVD Drive 1 --connect false
|
| VMManageFloppy |
VMManageFloppy
This sample adds / removes floppy to / from an existing VM
This sample lists information about a VMs Floppies
This sample updates an existing floppy drive on a VM
Parameters:
url [required] : url of the web service
username [required] : username for the authentication
password [required] : password for the authentication
vmname [required] : name of the virtual machine
operation [required] : operation type - [get|add|remove|set]
imgpath [optional] : path of image file
remote [optional] : device is a remote or client device or iso
startconnected [optional] : virtual floppy starts connected on VM poweron
connect [optional] : virtual floppy is connected
Set only if the VM is powered on
label [optional] : used to find the device.key value
device [optional] : path to the floppy on the VM's host
Command Line:
Get Floppy Info");
run.bat com.vmware.vm.VMManageFloppy
--url [webserviceurl] --username [username] --password [password]
--operation get --vmname [Virtual Machine Name]
Add Floppy
run.bat com.vmware.vm.VMManageFloppy
--url [webserviceurl] --username [username] --password [password]
--operation add --vmname [Virtual Machine Name]
--imgpath test.flp --remote false --connect true
Remove Floppy
run.bat com.vmware.vm.VMManageFloppy
--url [webserviceurl] --username [username] --password [password]
--operation remove --vmname [Virtual Machine Name]
--label Floppy Drive 1
Reconfigure Floppy
run.bat com.vmware.vm.VMManageFloppy
--url [webserviceurl] --username [username] --password [password]
--operation set --vmname [Virtual Machine Name]
--label Floppy Drive 1 --connect false
|
| VMotion |
VMotion
Used to validate if VMotion is feasible between two hosts or not,
It is also used to perform migrate/relocate task depending on the data given
Parameters:
url [required] : url of the web service
username [required] : username for the authentication
password [required] : password for the authentication
vmname [required] : name of the virtual machine
targethost [required] : Name of the target host
sourcehost [required] : Name of the host containing the virtual machine
targetpool [required] : Name of the target resource pool
targetdatastore [required] : Name of the target datastore
priority [required] : The priority of the migration task:-
default_Priority, high_Priority,low_Priority
state [optional]
Command Line:
run.bat com.vmware.vm.VMotion --url [URLString] --username [User] --password [Password]
--vmname [VMName] --targethost [Target host] --sourcehost [Source host] --targetpool [Target resource pool]
--targetdatastore [Target datastore] --priority [Migration task priority] --state
|
| VMPowerOps |
VMPowerOps
Demonstrates VirtualMachine Power operations on multiple Virtual Machines.
|
| VMPowerStateAlarm |
VMPowerStateAlarm
This sample which creates an Alarm to monitor the virtual machine's power state
Parameters:
url [required] : url of the web service
username [required] : username for the authentication
password [required] : password for the authentication
vmname [required] : Name of the virtual machine
alarm [required] : Name of the alarms
Command Line:
Create an alarm AlarmABC on a virtual machine
run.bat com.vmware.vm.VMPowerStateAlarm --url [webserviceurl]
--username [username] --password [password] --vmname [vmname] --alarm [alarm]
|
| VMPromoteDisks |
VMPromoteDisks
Used to consolidate a linked clone by using promote API.
|
| VMReconfig |
VMReconfig
Reconfigures a virtual machine, which include reconfiguring the disk size, disk mode, etc.
|
| VMRelocate |
VMRelocate
Used to relocate a linked clone using disk move type
Parameters:
url [required] : url of the web service
username [required] : username for the authentication
password [required] : password for the authentication
vmname [required] : name of the virtual machine
diskmovetype [required] : Either of
[moveChildMostDiskBacking | moveAllDiskBackingsAndAllowSharing]
datastorename [required] : Name of the datastore
Command Line:
run.bat com.vmware.vm.VMRelocate --url [URLString] --username [User] --password [Password]
--vmname [VMName] --diskmovetype [DiskMoveType] --datastorename [Datastore]
|
| VMSnapshot |
VMSnapshot
This sample demonstrates VM snapshot operations
Parameters:
url [required] : url of the web service.
|
| WaitForValues |
|
| WeeklyRecurrenceScheduledTask |
WeeklyRecurrenceScheduledTask
This sample demonstrates creation of weekly recurring ScheduledTask
using the ScheduledTaskManager
Parameters:
url [required] : url of the web service
username [required] : username for the authentication
password [required] : password for the authentication
vmname [required] : virtual machine to be powered off
taskname [required] : Name of the task to be created
Command Line:
run.bat com.vmware.scheduling.WeeklyRecurrenceScheduledTask
--url [webserviceurl] --username [username] --password [password]
--vmname [VM name] --taskname [TaskToBeCreated]
|
| XVCvMotion |
XVCvMotion
Used to Relocate VM from one VC to another.
|
| XVMotion |
|