• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

virtuallyGhetto

  • About
  • Privacy
  • VMware Cloud
  • Home Lab
  • Nested Virtualization
  • Automation
    • VMware Kickstart
    • VMware API/SDK/CLI
    • VMware vMA/VIMA
    • VMware OVF / OVFTOOL
  • Apple Mac
  • VCSA
  • VSAN
You are here: Home / Automation / Extracting VID, DID & SVID from PCI devices in ESXi using vSphere API

Extracting VID, DID & SVID from PCI devices in ESXi using vSphere API

05/18/2015 by William Lam 3 Comments

From time to time, you may need to collect some hardware related information such as PCI devices found within your ESXi hosts. In the past, you may have gone directly to the ESXi Shell running some of the legacy esxcfg-* commands for extracting things like the PCI device's Vendor ID (VID), Device ID (DID) and Sub Vendor ID (SVID) which can be used to correlate against VMware's HCL as seen in the screenshot below.

extract-pci-vid-did-svid-0
I personally try to stay out of the ESXi Shell if I can help it and prefer to retrieve these things using an API, such as the vSphere API. Historically, I too thought the VID, DID & SVID properties were only available within the ESXi Shell, but they are actually readily available in the vSphere API. You can find all PCI devices under the hardware.pciDevice property of an ESXi host and below are the three variables that map to these properties.

  • Vendor ID (VID) = vendorId
  • Device ID (DID) = deviceId
  • Sub Vendor ID (SVID) = subVendorId

To quickly demonstrate how you can extract this information using the vSphere API which can be done by connecting either directly to an ESXi host or by going to vCenter Server, I have created a simple PowerCLI script called queryHostPCIInfo.ps1.

Here is an example output of running the script against my Mac Mini and we can see details such as the device name, vendor and the respective VID, DID & SVID values.

extract-pci-vid-did-svid-1
If there are other properties which you still find yourself going directly to the ESXi Shell, please leave a comment as I know the PM's are interested in these information and is working hard to ensure that all these properties are available through our vSphere API.

More from my site

  • Automating Customer Experience Improvement Program (CEIP) configuration using vSphere API and PowerCLI
  • Instant Clone Microsoft Windows & VM Keystroke VMworld demo and code posted
  • Retrieving detailed per-VM space utilization on VSAN
  • Quick Tip – How do I tell if NSX-V or NSX-T is installed?
  • How do you “log a reason” using PowerCLI when rebooting or shutting down ESXi host?
Share this...
  • Twitter
  • Facebook
  • Linkedin
  • Reddit
  • Pinterest

Filed Under: Automation, ESXi, vSphere Tagged With: device id, did, pci, subvendor id, svid, vendor id, vid, vSphere API

Reader Interactions

Comments

  1. Michael Ryom (@MichaelRyom) says

    05/18/2015 at 8:06 pm

    But does the vmware hcl have an api to query the result from the host? That would be sweet

    Reply
    • William Lam says

      05/18/2015 at 10:08 pm

      If you’re working with VSAN, there’s a VSAN Health Check Plugin which automatically does this and queries against VSAN HCL DB via JSON file that’s provided. It would be nice to have an API or similar JSON file for the entire VMware HCL …

      Reply
  2. Chris says

    02/16/2018 at 5:02 am

    Great Work, is there any way of getting the SubdeviceID query in this script?

    Reply

Thanks for the comment! Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

Author

William Lam is a Senior Staff Solution Architect working in the VMware Cloud team within the Cloud Services Business Unit (CSBU) at VMware. He focuses on Automation, Integration and Operation for the VMware Cloud Software Defined Datacenters (SDDC)

  • Email
  • GitHub
  • LinkedIn
  • RSS
  • Twitter
  • Vimeo

Sponsors

Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy