Quantcast
Channel: VMware Communities : All Content - All Communities
Viewing all articles
Browse latest Browse all 175326

SCSI ID change error after upgrading PowerCLI to 6.5

$
0
0

This worked in PowerCLI 5.5 but fails in PowerCLI 6.5.  How can I change the SCSI ID of a harddisk in 6.5?  I get this error:

 

Exception setting "device": "Cannot convert the "VMware.Vim.VirtualDisk" value of type "VMware.Vim.VirtualDisk" to type "VMware.Vim.VirtualDevice"."

At line:1 char:1

+ $spec.deviceChange[0].device = $disktochange.ExtensionData

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : NotSpecified: (:) [], SetValueInvocationException

    + FullyQualifiedErrorId : ExceptionWhenSetting

 

 

This code Works fine before upgrading to PowerCLI 6.5:

 

                   $thisvm = Get-VM $vmname

                    $disktochange = Get-HardDisk -VM $thisvm -Name 'Hard disk 3'           

                    #change disk 3 to SCSI ID 1:0 since it defaults to 1:2

                    ## create a new VirtualMachineConfigSpec, with which to make the change to the VM's disk

                    $spec = New-Object VMware.Vim.VirtualMachineConfigSpec

                    ## create a new VirtualDeviceConfigSpec

                    $spec.deviceChange = New-Object VMware.Vim.VirtualDeviceConfigSpec

                    $spec.deviceChange[0].operation = 'edit'

                    ## populate the 'device' property with the existing info from the hard disk to change

                    $spec.deviceChange[0].device = $disktochange.ExtensionData

                    ## then, change the second part of the SCSI ID (the UnitNumber)

                    $spec.deviceChange[0].device.unitNumber = 0

                    ## reconfig the VM with the updated ConfigSpec (VM must be powered off)

                    $thisvm.ExtensionData.ReconfigVM_Task($spec)


Viewing all articles
Browse latest Browse all 175326

Trending Articles