VMware Cloud Community
Derek_Purdy
Contributor
Contributor

deploying a vm with PowerCLI new-vm using advanced datastore options?

When using the new-vm powercli cmdlet, is there a way to use the advanced datastore option as is you were doing it from the GUI. We place our configuration file and harddisk on one LUN and a disk to use for swap on another LUN.

unforunately using the -Datastore option if just places all disks in the same datastore.

Does anyone else have this requirement? And developed any workarounds?

New-VM -Name $vmname -Template $template -Datastore $datastore -VMHost $vmhost | Set-VM -OSCustomizationSpec $custspec -Confirm:$false

0 Kudos
1 Reply
RvdNieuwendijk
Leadership
Leadership

Hi Derek,

I would create the VM using the New-VM cmdlet with only the systemdisk. Then I would use the New-HardDisk cmdlet to create the additional hard disk and place it directly on the right datastore.

Regards, Robert

Blog: https://rvdnieuwendijk.com/ | Twitter: @rvdnieuwendijk | Author of: https://www.packtpub.com/virtualization-and-cloud/learning-powercli-second-edition