Reply to Message

View discussion in a popup

Replying to:
LucD
Leadership
Leadership

It is all documented in the VMware vSphere API Reference, but as the title states, it is a reference.

The vSphere Web Services SDK Programming Guide is intendedas a learning guide.


The only non-VMware book that explains a bit more about the vSphere API and the objects is the book by Steve Jin, called VMware VI and vSphere SDK: Managing the VMware Infrastructure and vSphere

It is written for Java developers, but it explains the basic concepts.

In this specific question, you need to know that all the devices connected to a VM can be found in Config.Hardware.Device.

It's a matter of looping through the devices and extracting the virtual SCSI controllers that also have physical bus sharing active.

Once you have that, it's simple to extract the properties.

foreach($vm in Get-View -ViewType VirtualMachine -Property Name,Config.Hardware.Device){

    $scsi = $vm.Config.Hardware.Device | where {$_ -is [VMware.Vim.VirtualSCSIController] -and $_.SharedBus -eq 'physicalSharing'}

    if($scsi){

        $scsi | Select @{N='VM';E={$vm.Name}},

            @{N='Controller';E={$_.DeviceInfo.Label}},

            @{N='BusSharingMode';E={$_.SharedBus}}

    }

}


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

Reply
0 Kudos