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 and ImageImportSpec


PowerShell and ImageImportSpec



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

I have used blog from:  as input for creating the PowerShell script


I can't get it to work.... i'm stuck at importing the image. I'm trying to do a "ImageImportSpec" in powershell but i can't figure out. Here's my code:




$ImgCreateSpec = New-NTNXObject -Name ImageImportSpecDTO
$ContainerID = (Get-NTNXContainer -SearchString "Container Name").id

$ImgCreateSpec.containerid = $ContainerID.Substring($ContainerID.IndexOf(":")+2)
$ImgCreateSpec.url = "nfs://"


New-NTNXImage -Name "Test" -ImageType DISK_IMAGE -ImageImportSpec $ImgCreateSpec


I recieve a task-UUID, but in the web console ImageCreate task is failed almost immediatly. Bucnh of errors in and 


Any ideas?


I will share my powershell script once I got it working




Nutanix Employee

Re: PowerShell and ImageImportSpec

@Buch The script you are using is correct. If the image creation fails immediately then it could be the permissions on the image is restrictive. Please use winscp to connect to one of the CVM ip with protocol as sftp and port as 2222, use prism admin usernameto login. Once logged in Navigate to the migration container and check the properties of the vhdx to see if others have read,write bits set?

Nutanix Employee

Re: PowerShell and ImageImportSpec



As @Chandru mentioned, this looks like a "Permission issue".

Check the image creation task status in Prism tasks.

If this is a permission issue you will receive error similar to the below.

Screen Shot 2017-11-12 at 12.31.39 PM.png


or from powershell.


Screen Shot 2017-11-12 at 12.43.56 PM.png

Check the file permission and set it to 777.

Screen Shot 2017-11-12 at 12.35.20 PM.png


After changing the permission try again and image should get created without any issues.


Screen Shot 2017-11-12 at 12.37.13 PM.png


Task status:

Screen Shot 2017-11-12 at 12.38.53 PM.png


Let us know if you still face any issues.

Nutanix Employee

Re: PowerShell and ImageImportSpec


How are you?

Is the issue fixed?

Hope we were able to answer your queries.

If so, please mark the post as resolved