Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
add comment

1 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

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

Your Answer

 
discard

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.