Hi,
Thanks to project Onyx, I have script generated to add an RDM to a VM and here is the script i modified. but when i run it, i get an error saying - "
“Cannot complete operation due to concurrent modification by another operation.”
Can someone please shed some light why i keep getting this error? thanks in advance.
Here is the script i am trying to run-
$vmMo = Get-View (Get-VM lglod097).ID
$spec = New-Object VMware.Vim.VirtualMachineConfigSpec
$spec.changeVersion = "2012-02-07T16:03:04.159161Z"
$spec.deviceChange = New-Object VMware.Vim.VirtualDeviceConfigSpec[] (1)
$spec.deviceChange[0] = New-Object VMware.Vim.VirtualDeviceConfigSpec
$spec.deviceChange[0].operation = "add"
$spec.deviceChange[0].fileOperation = "create"
$spec.deviceChange[0].device = New-Object VMware.Vim.VirtualDisk
$spec.deviceChange[0].device.key = -100
$spec.deviceChange[0].device.backing = New-Object VMware.Vim.VirtualDiskRawDiskMappingVer1BackingInfo
$spec.deviceChange[0].device.backing.fileName = ""
$spec.deviceChange[0].device.backing.deviceName = "/vmfs/devices/disks/naa.60060160987b2500346e156c0f98de11"
$spec.deviceChange[0].device.backing.compatibilityMode = "physicalMode"
$spec.deviceChange[0].device.backing.diskMode = ""
$spec.deviceChange[0].device.connectable = New-Object VMware.Vim.VirtualDeviceConnectInfo
$spec.deviceChange[0].device.connectable.startConnected = $true
$spec.deviceChange[0].device.connectable.allowGuestControl = $false
$spec.deviceChange[0].device.connectable.connected = $true
$spec.deviceChange[0].device.controllerKey = 1000
$spec.deviceChange[0].device.unitNumber = 1
$spec.deviceChange[0].device.capacityInKB = 1121976320
$VmMo.ReconfigVM_Task($spec)