VMware Cloud Community
morphyno
Enthusiast
Enthusiast
Jump to solution

Create a VM to a specific directory on the datastore

I wish to deploy a VM to a specific directory that I have created on the destined datastore.

Basically, on my datastore, I have directories "/Production", "/Dev", and "/Staging". I wish to run "New-VM" cmdlet to directly deploy VM's to a particular directory on the datastore side

The "option" -Location for "New-VM", applies to VM folders.

I have found this thread to be very usefull in creating the directory Creating new folder in a DataStore , but can't seem to find any reference on saving to specific datastore folders

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

The bad news, you can't with the New-VM cmdlet.

And afaik you can't even do that with the underlying API method CreateVM_Task

The only way I could see this being accomplished, is by

  • creating a VM with the New-VM cmdlet in the standard location on a datastore
  • unregister the VM
  • copy all the VM's files to a new folder (with the datastore provider)
  • register the VM from that new location


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

View solution in original post

0 Kudos
1 Reply
LucD
Leadership
Leadership
Jump to solution

The bad news, you can't with the New-VM cmdlet.

And afaik you can't even do that with the underlying API method CreateVM_Task

The only way I could see this being accomplished, is by

  • creating a VM with the New-VM cmdlet in the standard location on a datastore
  • unregister the VM
  • copy all the VM's files to a new folder (with the datastore provider)
  • register the VM from that new location


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

0 Kudos