Automate the process of managing (upgrade/new) VMWare through Vsphere from TestComplete

64 Views Asked by At

We are looking to automate the process of managing(Upgrade/New) VMWare through Vsphere from Test Complete.

The general flow is:

a. Launch Vsphere client b. Navigate to specific Cluster in Vsphere c. Power On Respective Server VM or Create a new VM

Any pointers for the above implementation will be helpful. Many thanks!

2

There are 2 best solutions below

0
On

VMware vSphere has API with libraries for many languages. You can use its Java or .NET version to work with vSphere from TestComplete with its Java Bridge or CLR Bridge features.

0
On

It looks like TestComplete supports multiple scripting languages. I would say the easiest way to do what you want would be to use VMware PowerCLI (a PowerShell module/suite for managing vSphere and other VMware products) to automate this process.

Basic PowerCLI script you would use would be:

Connect-VIServer Your_vCenter_FQDN_or_IP_here -username first.last -password yourloginpassword
$existingVM = Get-Cluster CLUSTERNAME | Get-VM VMNAME
if ($existingVM)
{
    Start-VM $existingVM
}
else 
{
    New-VM -Name VMNAME # probably need a few more mandatory paramaters specified here...
}