This sample is used to add a Virtual Nic
To run this samples following parameters are used:
vsiwtchid [required]: Name of the switch
portgroupname [required]: Name of the port group
ipaddress [required]: ipaddress for the nic
host [optional]: Name of the host
datacenter [optional]: Name of the datacenter
Command Line:To add a Host VirtualNic to a PortGroup on a Virtual Switch as: -
run.bat com.vmware.samples.host.AddVirtualNic --url [webserviceurl] --username [username] --password [password]
--vsiwtchid [mySwitch] --host [hostname] --datacenter [mydatacenter] --portgroupname [myportgroup] --ipaddress[AAA.AAA.AAA.AAA]
Command Line:To add a Host VirtualNic to a PortGroup on a Virtual Switch as
without specifying the host name run.bat com.vmware.samples.host.AddVirtualNic --url [webserviceurl] --username [username] --password [password]
--vsiwtchid [mySwitch] --datacenter [mydatacenter] --portgroupname [myportgroup] --ipaddress[AAA.AAA.AAA.AAA]
Command Line:To add a Host VirtualNic to a PortGroup on a Virtual Switch as
without specifying the datacenter name
run.bat com.vmware.samples.host.AddVirtualNic --url [webserviceurl] --username [username] --password [password]
--vsiwtchid [mySwitch] --portgroupname[myportgroup] --ipaddress[AAA.AAA.AAA.AAA]
This sample is used to add a virtual switch
To run this samples following parameters are used:
vsiwtchid [required]: Name of the switch to be added
host [optional]: Name of the host
datacenter [optional]: Name of the datacenter
Command Line: to add a Virtual Switch on a virtual center as: -
run.bat com.vmware.samples.host.AddVirtualSwitch --url [webserviceurl] --username [username] --password [password]
--vsiwtchid [mySwitch] --datacenter [mydatacenter]
This sample is used to add a Virtual Switch PortGroup
To run this samples following parameters are used:>
vsiwtchid [required]: Name of the switch in which portgroup is to be added
portgroupname [required]: Name of the port group
host [optional]: Name of the host
datacenter [optional]: Name of the datacenter
Command Line:to add a Virtual switch Port Group as: -
run.bat com.vmware.samples.host.AddVirtualSwitchPortGroup --url [webserviceurl] --username [username] --password [password]
--vsiwtchid [mySwitch] --datacenter [mydatacenter] --portgroupname [myportgroup] --host[hostname]
Command Line:to add a Virtual switch Port Group without specifying the host:
run.bat com.vmware.samples.host.AddVirtualSwitchPortGroup --url [webserviceurl] --username [username] --password [password]
--vsiwtchid [mySwitch] --datacenter [mydatacenter] --portgroupname [myportgroup]
Command Line:to add a Virtual switch Port Group without specifying the datacenter -
run.bat com.vmware.samples.host.AddVirtualSwitchPortGroup --url [webserviceurl] --username [username] --password [password]
--vsiwtchid [mySwitch] --portgroupname [myportgroup]
This sample prints all managed entity, its type, reference value,
property name, Property Value, Inner Object Type,
its Inner Reference Value and inner property value.
Browser() -
Constructor for class com.vmware.samples.general.Browser
Several sample applications that demonstrate a variety of inventory operations,
such as connecting to the server (Connect), browsing the inventory (Browse),
and moving an entity from one location in the inventory to another (Move).
enumerateCIMInstances
wrapper to provide an enumerator over all the instances of the class specified
parameters are a subset of the enumerateInstance params.
It Retrieves and format the lastEvent - Hostd or Vpxd
Command Line:
run.bat com.vmware.samples.vm.EventFormat --url [webserviceurl]
--username [username] --password [password]
This is a simple standalone client whose purpose is to
demonstrate the creation of a ScheduledTask using the
ScheduledTaskManager
To run this samples following parameters are used :
taskname [required] : name of the task to be scheduled
vmname [required] : name of the virtual machine
Command Line:
run.bat com.vmware.samples.vm.OneTimeScheduledTask --url
[webserviceurl] --username [username] --password [password]
--taskname [myTask]
This sample excercise the PropertyCollector API of all the managed entity
To run this samples following parameters are used :
dcName [required] : name of the datacenter.
This sample is used to remove a Virtual Nic
To run this samples following parameters are used:
portgroupname [required]: Name of the port group from which the nic is to be removed
host [optional]: Name of the host
datacenter [optional]: Name of the datacenter
Parameters:Command Line:to remove a Host VirtualNic from a PortGroup
run.bat com.vmware.samples.host.RemoveVirtualNic --url [webserviceurl] --username [username] --password [password]
--datacenter [mydatacenter] --portgroupname [myportgroup]> --host [hostname]
Command Line: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] --portgroupname [myportgroup]
Command Line: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]
--portgroupname [myportgroup] --host [name of the host]
This sample is used to remove a virtual switch
To run this samples following parameters are used:
vsiwtchid [required]: Name of the switch to be removed
host [optional]: Name of the host
datacenter [optional]: Name of the datacenter
Command Line: to remove the Virtual Switch from a virtual center
run.bat com.vmware.samples.host.RemoveVirtualSwitch --url [webserviceurl] --username [username] --password *[password] --vsiwtchid [mySwitch] --datacenter [mydatacenter] --host[hostname]
Command Line: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] --vsiwtchid [mySwitch] --datacenter [mydatacenter]
Command Line: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] --vsiwtchid [mySwitch] --host [host]
This sample is used to remove a Virtual Switch PortGroup
To run this samples following parameters are used:
Parameters:
portgroupname [required]: Name of the port group to be removed
host [optional]: Name of the host
datacenter [optional]: Name of the datacenter
Command Line: To remove a Virtual Switch Port Group
run.bat com.vmware.samples.host.RemoveVirtualSwitchPortGroup --url [webserviceurl]
--username [username] --password
--datacenter [mydatacenter] --portgroupname[Command Line: To remove a Virtual Switch Port Group without specifying the host name
run.bat com.vmware.samples.host.RemoveVirtualSwitchPortGroup --url [webserviceurl]
--username [username] --password
--datacenter [mydatacenter] --portgroupname[Command Line: To remove a Virtual Switch Port Group without specifying the datacenter name
run.bat com.vmware.samples.host.RemoveVirtualSwitchPortGroup --url [webserviceurl] --username [username] --password
--portgroupname[
srcPropertyFilter
Format :
Tokens :
Value ops : = (equals) * (partially equals one in set) ? (partially equals)
Expression Ops : & (boolean and) | (boolean or) ! (negate)
Examples :
Property=value // property equals value
Property?value // value is partially contained in retrieved value
Property*value1,value2,value3 // one of the values is partially contained
!Property*value,value2,value3 // value is not in the set of values
Property1=value1&Property2=value2 // expression with 2 properties
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.
VITop() -
Constructor for class com.vmware.samples.performance.VITop
This sample shows how to write CIM client applications in Java,
to connect to and retrieve different CIM instances from the Service,
retrieve associated CIM instances and invoke operations
like Clearing the RecordLog.
This is a simple standalone client whose purpose is to demonstrate the
process for Logging into the Webservice, Creating EventHistoryCollector
filtered for a single VM and monitoring Events using the
latestPage attribute of the EventHistoryCollector
To run this samples following parameters are used :
vmpath [required] : A VM Inventory Path
Command Line:
run.bat com.vmware.samples.vm.VMEventHistoryCollectorMonitor --url [webserviceurl]
--username [username] --password [password] --vmPath [vm inventory Path]
This sample is 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
To run this samples following parameters are used :
vmname [required] : Name of the virtual machine
targethost [required] : Name of the target host
sourcehost [required] : Name of the host containg the virtual machine
targetpool [required] : Name of the target resource pool
targetdatastore [required] : Name of the target datastore
priority [optional] : The priority of the migration task: defaultPriority, highPriority, lowPriority
state [optional] :
Command:Relocate or migrate a VM
run.bat com.vmware.samples.version.VMotion --url [webserviceurl]
--username [username] --password [password] --targetpool [tpool]
--sourcehost [shost] --targethost [thost] --vmname [myVM] --targetdatastore [tDS]
Validate the vmotion capability
run.bat com.vmware.samples.version.VMotion --url [webserviceurl]
--username [username] --password [password] --targetpool [tpool]
--sourcehost [shost] --targethost [thost] --vmname [myVM] --targetdatastore [tDS]
--validate
This sample Performs powerops operations on the virtual machines
To run this samples following parameters are used:
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
Command Line:
run.bat com.vmware.samples.vm.VMpowerOps --url --username --password
--operation --folder
--guestid --datacenter
This is a sample which creates an Alarm to monitor the virtual
machine's power state
Parameters:
vmname [required] Name of the virtual machine
alarm [required] Name of the alarms
Command Line to create an alarm "AlarmABC" on a virtual machine
run.bat com.vmware.samples.vm.VMPowerStateAlarm --url [webserviceurl]
--username [username] --password [password] --vmname [vmname]
--alarm [alarm]
This sample Performs virtual machine snapshot operations
To run this samples following parameters are used:
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]:if children needs to be removed and 0 if children
needn't be removed
Command Line:To list the name of the snapshot
run.bat com.vmware.samples.vm.VMSnapshot --url [webserviceurl]
--username [username] --password [password] --vmname [vmname]
--operation [list]
Command Line: 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]
Command Line: 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]
Command Line: 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]
This is a simple standalone client whose purpose is to demonstrate the
process of creation of a ScheduledTask
using the ScheduledTaskManager
To run this samples following parameters are used :
taskname [required] : name of the task to be scheduled
vmpath [required] :VM Inventory Path
Command Line:
run.bat com.vmware.samples.vm.WeeklyRecurrenceScheduledTask --url [webserviceurl]
--username [username] --password [password]
--vmpath ["/DatacenterName/vm/FolderName/myVM"]
--taskname [Task1]