Welcome to the Nutanix NEXT community. To get started please read our short welcome post. Thanks!

Showing results for 
Search instead for 
Did you mean: 

Powershell clone from ADSF


Powershell clone from ADSF



We just got a nutanix cluster and i'm trying to write a script that will migrate a machine from ESXi to AHV using powershell.

I'm at the last piece and i can't get it to work.... i'm stuck at adding disk. I'm trying to do a "Clone from ADSF file" in powershell but i can't figure out. Here's my code:


#Get VM id

$vminfo = Get-NTNXVM | where {$_.vmName -eq "server1"}
$vmId = ($vminfo.vmid.split(":"))[2]


$diskCloneSpec = New-NTNXObject -Name VMDiskSpecCloneDTO

$diskCloneSpec.imagepath = "/vm-general/server1/server1-flat.vmdk"

$vmDisk = New-NTNXObject -Name VMDiskDTO
$vmDisk.vmDiskClone = $diskCloneSpec


 Add-NTNXVMDisk -Vmid $vmId -Disks $vmDisk


And i get this error:


Add-NTNXVMDisk : The remote server returned an error: (500) Internal Server Error.
At line:1 char:1
+ Add-NTNXVMDisk -Vmid $vmId -Disks $vmDisk
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (Nutanix.Prism.Common.NutanixCluster:Nuta
nixCluster) [Add-NTNXVMDisk], WebException
+ FullyQualifiedErrorId : {"message":"At least one of Image path or VM Disk UUID are


Any ideas?


I will share my script once done.


Community Manager

Re: Powershell clone from ADSF

Thanks for sharing @AlexR -- I wonder if @Sandeep can get some eyes on it to help out.

Tags (2)
Nutanix Employee

Re: Powershell clone from ADSF

@AlexR Could you please email me and I will see who can assist you further. -