VMware Powercli – Gather NIC Driver and Firmware Versions from Hosts via vCenter

I recently encountered an issue in vSphere 5.5 where I wasn’t able to change the interface speed on an ESXi host from auto-negotiate to anything else. After a good amount of troubleshooting I was able to determine that this issue was occurring due to the fact that the NIC firmware version and driver version on a blade server was out of date. VMware has a good KB article on how to grab the firmware and driver versions that I followed. However, the problem is that even on the most modest ESXi host that isn’t running 10G to it, you’ll likely have a minimum of 4 NICs on it. This means that you’ll have to enable SSH on every host you want to check, run one command per NIC each of them (or run a one line script that loops through them, but will that really save you time..?). It doesn’t take a very large cluster for that to become a very large endeavor.

This PowerShell script will connect to a vCenter server, allow you to scan all ESXi hosts, or only hosts within a particular cluster, and output the results in object format so that you can manipulate them how you wish.

As a refresher, the esxcli command you’ll run to list the required information is below. Substitute [#IFINDEX] with the interface index you want to look at (ie, vmnic1)

esxcli network nic get -n vmnic[#IFINDEX]

Which will output something like this:

Advertised Auto Negotiation: true
Advertised Link Modes: 1000baseT/Full, 2500baseT/Full, 10000baseT/Full
Auto Negotiation: true
Cable Type: FIBRE
Current Message Level: 0
Driver Info:
       Bus Info: 0000:02:00.0
       Driver: bnx2x
       Firmware Version: bc 6.2.28 phy baa0.105
       Version: 2.710.39.v55.2
Link Detected: true
Link Status: Up
Name: vmnic0
PHYAddress: 16
Pause Autonegotiate: true
Pause RX: true
Pause TX: true
Supported Ports: FIBRE
Supports Auto Negotiation: true
Supports Pause: true
Supports Wakeon: true
Transceiver: internal
Wakeon: MagicPacket(tm)

The key info is bold above. The Version: line is referring to the Driver version.

Now, what if you could gather the same information for every host in attached to a vCenter server by simply running a single command specifying your VirtualCenter server and the cluster name. The script below will do exactly that. See comment based help for more info.

Leave a Reply

Your email address will not be published. Required fields are marked *

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

Copyright VirtJunkie.com © 2020