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.
You can download my script from the github.
Thanks, that works perfectly, even better when I spotted the export-csv at the bottom 🙂