PowerCLI: Get the Vmnic CDP Information of Esxi Hosts

In these days, I do have to backup the CDP info of our current esxi hosts and fortunately I found script this blog and official VMware site to discover information. Only I made little changes to the script to suite my environment. You need Powercli (PowerCLI 5.5 is here) already installed, and must be connected to vCenter of specific Esxi host before running the script.

If you’re not connected to vCenter, you can use the command:
Connect-VIServer -Server yourServerNameOrIP -Credential (Get-Credential)

After you have finished running the script, you can disconnect the vCenter Server by using the following command.
Disconnect-VIServer -Server yourServerNameOrIP

Note: You can also add the esxi hostnames in the hostlist.txt to get the CDP info for specific hosts only. If the hostlist.txt file doesn’t exit, then it will gather information for all Esxi hosts.

PowerCLI Get CDP Info

Fig-1: Demo of Getting the CDP Info

You can download my script from the github.

This entry was posted in PowerCLI. Bookmark the permalink.

1 Response to PowerCLI: Get the Vmnic CDP Information of Esxi Hosts

  1. gerg says:

    Thanks, that works perfectly, even better when I spotted the export-csv at the bottom 🙂

Leave a Reply

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