Is it possible to script within the vsphere web client?

1

I've been attempting to write a script that will create multiple vm's from a given template. But I haven't found much documentation on scripting within the vSphere web client, has anyone done this before?

Dr.Sys

Posted 2019-07-31T18:08:33.057

Reputation: 11

1

Take a look at the vsphere automation sdk https://code.vmware.com/web/sdk/6.7/vsphere-automation-python EDIT: there is one for .net https://code.vmware.com/web/sdk/6.7/vsphere-automation-dotnet so it is closer to powershell for you.

– Narzard – 2019-07-31T18:18:34.133

also see here: https://www.businessnewsdaily.com/11038-use-powercli-vsphere-deployment.html

– Narzard – 2019-07-31T18:23:34.187

Answers

2

This can be done using powercli for vsphere.

Download PowerCli ( https://www.powershellgallery.com/packages/VMware.PowerCLI/6.5.1.5377412 )

Here is an example of creating a VM:

Connect to my vCenter server named "vcenter" in PowerShell.

C:> Connect-VIServer –Server 'vcenter'

Run New-VM while specifying the VM name, VMHost, datastore, number of CPU's, hard disk size and the network name.

C:> New-VM -Name 'TestVM' –VMHost 'VMHost-1' -Datastore 'TestDatastore' -DiskGB 40 -MemoryGB 8 -NumCpu 2 -NetworkName 'Virtual Machine Network'

Here is an example of **cloning a new template called "Win7Template" from the VM "Win7VM".

C:> New-Template -VM 'Win2012VM' -Name "Server2012R2Template" -Datastore 'TestDatastore' -Location 'TestLocation'

Narzard

Posted 2019-07-31T18:08:33.057

Reputation: 2 276