WilliamLam.com

  • About
    • About
    • Privacy
  • VMware Cloud
  • Tanzu
    • Application Modernization
    • Tanzu services
    • Tanzu Community Edition
    • Tanzu Kubernetes Grid
    • vSphere with Tanzu
  • Home Lab
  • Nested Virtualization
  • Apple
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?

Categories // Automation, ESXi, vSphere Tags // device id, did, pci, subvendor id, svid, vendor id, vid, vSphere API

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.

Search

Author

William Lam is a Senior Staff Solution Architect working in the VMware Cloud team within the Cloud Infrastructure Business Group (CIBG) at VMware. He focuses on Cloud Native technologies, Automation, Integration and Operation for the VMware Cloud based Software Defined Datacenters (SDDC)

Connect

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

Recent

  • Changing the default HTTP(s) Reverse Proxy Ports on ESXi 8.0 03/22/2023
  • Quick Tip - How to download ESXi ISO image for all releases including patch updates? 03/15/2023
  • SSD with multiple NVMe namespaces for VMware Homelab 03/14/2023
  • Is my vSphere Cluster managed by vSphere Lifecycle Manager (vLCM) as a Desired Image or Baseline? 03/10/2023
  • Interesting VMware Homelab Kits for 2023 03/08/2023

Advertisment

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

Copyright WilliamLam.com © 2023

 

Loading Comments...