I am having issues using PowerCLI to attach an RDM to a virtual machine. I have a script that is reported to have worked in the past on VC 2.5 and ESX3.5 But I wasn't there at the time this was in use. The environment is currently being upgraded in stages and as a result I now have VC4 and a couple of ESX4 servers with a couple of ESX3.5 servers.
What I need to be able to do from start to finish is add a SCSI controller to a VM, then add an RDM to that SCSI controller. So far adding a SCSI controller is not an issue, but at some point adding a RDM to a VM has ceased to function. Now when trying to add the VM i get the error "Incompatible device backing specified for device '0'" and the associated event for it is 'Cannot create virtual disk /vmfs/volumes/LUNID/scsitestvm/svsitestvm_LUN1.vmdk
I would also appreciate claification on what I should be populating the $spec.devicechange.device.backing.devicename with now that ESX4 uses runtime names for the LUN's rather than the more traditional vmhba1:1:2:0 format.
My knowledge of VMWare ESX is extensive, But I am reasonably new with Powershell and PowerCLI. I haven't had cause to use it for any other customers to this point.
So in a nutshell. I can create a new VM, then add a secondary SCSI controller with a script. I can then add a new RDM to that controller through the GUI without issue (On both ESX3.5 and ESX4). However if I try and use a script which I have been guranteed used to work on ESX3.5 and VC2.5 it no longer adds the RDM but instead finishes with an error. If I enter the VC details for the connect-viserver argument then I see the errors in virtualcenter, if I enter the ESX host directly I don't see any errors in VC, but neither method works.
I'd be happy to try another more updated script for ESX 4 if anyone has one they can point me to.
Looking forward to your responses.
This is the script that I am using. (I have added it as an attachment to try and make it more readable).
Message was edited by: matthew_hadfield to remove the script from the body of the message.