Powershell – PowerCLI – add shared hard disk to vm, using existing scsi controller

powerclipowershellvmware-vsphere

I would like to add a shared virtual disk to a second VM which is already attached to a first VM. They will have shared access to the disk, via SCSI controllers set to virtual bus sharing.

This works fine via the vCenter GUI, but I'd like to do it via PoweCLI.

I can't find a way to attach a new SCSI controller to the second VM, without passing in the existing hard disk as an argument to the new-scsicontroller cmdlet. Unfortunately, this results in a new SCSI controller on the first VM, not the second VM.

Any ideas how to do this with the vSphere API, or other techniques?

Best Answer

The best way to find get PowerCLI code for something you can't figure out is with Onyx: http://labs.vmware.com/flings/onyx

Related Topic