VMware PowerCLI – Report Cisco Discovery Protocol Details

Posted on Posted in Powershell, VMware

For those that have more than 10 physical NICs on your hosts you may find existing CDP scripts lack a little when trying to sort by hostname and then NIC

vmnic0
vmnic1
vmnic11
vmnic12
vmnic2
.
.
vmnicN

Nothing like a little regex and built-in padding to get everything in order.  Pass a vmhost host object to this function to get a report on all physical NICs and including padding for vmnic[0-9] matches so they are returned as vmnic0[0-9]: