Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
Show us more details of what exactly you're doing please – Chopper3 Aug 23 '11 at 17:25
Oh, I figured it out. I needed to add all the disks using new-harddisk on the second vm, and accumulating the objects in a variable. then go back and use the new-scsicontroller cmdlet on the second vm passing in the array of shared disks as a paramater. – sjw Aug 24 '11 at 17:26

The best way to find get PowerCLI code for something you can't figure out is with Onyx:

share|improve this answer
This is a very good tip. – ewwhite Oct 18 '11 at 20:13

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.