Boot disk index must be specified | Nutanix Community
Skip to main content

Hello All,

 

         I am working on a powershell script to create VM’s and I am having an issue with the following piece.

 

$boot=New-NutanixObject BootConfig
$boot.uefi_boot=$true
$boot.secure_boot=$true
$boot.boot_device_type='DISK'
$boot.disk_address=$vmDisk.vm_disk_clone.disk_address
 
The error I am seeing is “Boot disk index must be specified”
 
I used the following to make the $vmDisk variable you are seeing at the bottom of the trouble code.
 
$diskImage = (Get-Image | Where-object {$_.name -eq $vmdisks})
$diskImage = Get-Image -IncludeVmDiskId -ImageId $diskImage.UUID                
$cloneDiskAddress=New-NutanixObject VMDiskAddress
$cloneDiskAddress.vmdisk_uuid=$diskImage.vm_disk_id
$vmDiskClone=New-NutanixObject VMDiskSpecClone
$vmDiskClone.disk_address=$cloneDiskAddress
$vmDisk=New-NutanixObject VMDisk
$vmDisk.is_cdrom=$false
$vmDisk.vm_disk_clone=$vmDiskClone
 
 
I know it is something simple I just don’t know what it is.
 
I appreciate any help.
 
Thanks,
Scott

Hello All,

 

      I figured that part out. Below is the code required.

 

$boot=New-NutanixObject BootConfig
$boot.uefi_boot=$true
$boot.secure_boot=$true
$boot.boot_device_type='DISK'
$boot.disk_address=$vmDiskd0].vm_disk_clone.disk_address
$boot.disk_address.device_index = 0
$boot.disk_address.device_bus = 'SCSI'

 


Thanks for sharing @skeeter