VMware Cloud Community
VistaAdministra
Contributor
Contributor

Deploy template with multiple hard disks across multiple datastores

Hi All,

I need to deploy a template that has 2 hard disks (OS & DATA) and these disks need to be located on specific datastores.

How can I specify which hard disk goes to which datastore when I deploy the template?

Thanks

Tags (2)
0 Kudos
2 Replies
LucD
Leadership
Leadership

Afaik this is not possible with the New-VM cmdlet, you will have to use the CloneVM method.

There you can specify where each individual harddisk should be created.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
LittleNickey
Enthusiast
Enthusiast

You can probably have the template with only one disk (OS-disk) and specify where that should be, and then after add the second disk. Something like:

$Template = Get-Template -Name "tmplate"

$datastore1 = get-datastore ds1

$datastore2 = get-datastore ds2

New-VM -Template $Template -Name vm1 -Datastore $datastore1

$vm = get-vm vm1

$CapacityGB = 15

$vm | New-HardDisk -CapacityGB $CapacityGB -Datastore $datastore2

Obviously this can be done more effectively, but that's depending on what you want to do with the script. If you for example want to deploy multiple VM's through the script, then I wouldn't recommend using a static VM name like i did here (vm1).

-- Oskar
0 Kudos