PowerCLI

 View Only
  • 1.  Get PCI slot number for a virtual SCSI controller?

    Posted Nov 03, 2015 09:30 PM

    Is it possible to retrieve the PCI slot number of a virtual SCSI controller from PowerCLI?  I dug around a bit but I can't seem to find it anywhere in ExtensionData of either the SCSI controllers or the hard disks.

    I'd like to use it to correlate VMDKs to Windows Disks because every script that I've found goes off of an assumption about how devices are assigned PCI slots, and in my findings those assumptions aren't 100% reliable.

    I've checked the properties of both of these objects with no luck:

    $VirtualSCSIAdapters = $VMView.Config.Hardware.Device | Where-Object{$_.DeviceInfo.Label -match "SCSI controller"}

    $VirtualDiskDevices = $VMView.Config.Hardware.Device | Where-Object{$_.DeviceInfo.Label -match "Hard disk"}

    I know that at the very least, the slot information is stored in the vmx file.  As a worst case scenario, is it possible to harvest the data from vmx?



  • 2.  RE: Get PCI slot number for a virtual SCSI controller?
    Best Answer

    Posted Nov 04, 2015 09:42 PM

    Does this get you what you need?

    $vm = get-vm "test"

    $vm.ExtensionData.Config.ExtraConfig | where {$_.Key -eq "scsi0.pciSlotNumber"}



  • 3.  RE: Get PCI slot number for a virtual SCSI controller?

    Posted Nov 06, 2015 12:16 AM

    Wow, I have no idea how I missed the ExtraConfig but there is a wealth of information in there, including exactly what I'm looking for:

    scsi0.pciSlotNumber                                                                             160

    Thank you!!!