PowerShell Command Clone Virtual Machine

  • 5 November 2019
  • 5 replies

Userlevel 2
Badge +2

Could we get some more documentation on this command?


One of the required parameters is -SpecList

I would like some clarification on this parameter and how to use it. Is this an array of values? Am I linking to a csv or json file?

An example would be nice.

Using the UI, I currently clone a reference image to create vm’s and I would love to get a PS script to work to do the same. I can get it to work with the ACLI commands but PS is a bit more versatile and I believe I could get it to do more if I understood this command and specifically this parameter better.

5 replies

Userlevel 4
Badge +5


Cloning VM using PowerShell could be done to use Clone-NTNXVirtualMachine commandlet.
For example,

PS> spec = New-NTNXObject -Name VMCloneSpecDTO 
PS> = "cloneOne" 
PS> vm = get-ntnxvm | Where-Object { $_.vmName -eq "clone-base" } 
PS> Clone-NTNXVirtualMachine -Vmid $vm.vmId -SpecList $spec 

   +Create VMCloneSpecDTO and set new VM name to field.
   +Retrieve existing VM
   +Run Clone-NTNXVirtualMachine commandlet with vmid of the existing VM and spec object previously created.


So what exactly is New-NTNXObject?


The New-NTNXObject cmdlet to create a data transfer object (DTO) lists.


Hope this helps!


In addition to above I need to set TCP/IP parameters to cloned VM (IP, Subnet mask, GW, DNS1, DNS2). What is the method/cmdlet/parameters should I use? May be another DTO object, I guess?

From Acropolis v1 API Reference .pdf  and from other forum(s) I understood that there are few DTO predefined Names (at least VMCloneSpecDTO, VMCloneDTO, VMCustomizationConfigDTO ). Where can I receive full description of DTOs / other useful info along with Nutanix Powershell cmdlets examples (not only minimal function description).



were you able to get this working?


I did it in my VMware environment with PowerCLI. Now I have to do this in Nutanix cluster.


Userlevel 4
Badge +5

Hello @ValeryV @Tshepo 


You can use cloud-init or Sysprep(based on OS) to provide the details while cloning a VM. 

Details regarding the cloud-init

A post which can help you write a commandlet for cloud-init

A great article to use Sysprep to deploy Windows VM on AHV with configuration.