Scripts

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

cancel
Showing results for 
Search instead for 
Did you mean: 

Powershell clone from ADSF

Squire

Powershell clone from ADSF

Hi,

 

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
required."},Nutanix.Prism.PS.Cmds.Acropolis.AddVMDisk

 

Any ideas?

 

I will share my script once done.

Thanks

2 REPLIES
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)
Highlighted
Nutanix Employee

Re: Powershell clone from ADSF

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