Score:-3

Clone VMWare VM to multiple VMs

ve flag

I use vCenter cluster of several ESXi servers, with VSAN storage. I need to setup multiple VMs from a single vm. Is there a way to clone one VM to multiple VMs via vCenter? is there a feature for that? If not - I would like to use a script, that will run the cloning according to parameters: source VM to clone, new vm name, destination folder, IP, and hostname. I saw some examples of scripts, but couldn't understand where to run it... I logged in to vCenter using SSH, but none of the commands worked. Eventually, I'd be happy to have a step by step guide for this process.

Thanks all!

br flag
We expect question askers to have done something to try to fix problems for themselves and explain what they've tried already - clearly you've done none, nor any training in vCenter either - how hard would it be to just read some basic stuff about it, vCenter can be dangerous in untrained hands. This site is for professionals, please try to put some effort in ok.
Score:2
in flag

You need to create a customization specification for the VMs. These are defined in vCenter and allow you to predetermine some settings that are then used when cloning the VM.

Afterwards you can easily use the specification in scripts, for example with PowerCLI:

$sourceVM = get-vm oldvm
$specs = Get-OSCustomizationSpec -name "MyCustomization"
$vmhost = Get-VMHost esx.example.com
"clone1","clone2" |% { 
    new-vm -vm $sourceVM -Name $_ -OSCustomizationSpec $specs -VMHost $vmhost -Location $sourceVM.Folder
}

This would create two clones from the vm oldvm. The specification can be configured to change the hostname of the clone to the name of the VM, network settings can be set to be determined by DHCP or to be specified during cloning.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.