Tuesday, September 10, 2013

Enable CDP on ESXi host using PowerCLI

Adding new VLANs to ESXi hosts becomes very hard if the location of the host NICs are not properly documented on the physical switch. In order to make things easier, below is a powershell script to enable CDP on a standard vSwitch. Enabling CDP will show the hostname of the ESXi host as a neighbour to the physical switch and the ports they are connected to.

Connect-VIServer vcenter01

$esxcli = Get-EsxCli -VMHost "ESXi01"
$esxcli.network.vswitch.standard.set("both","1500","vSwitch0")

Disconnect-VIServer vcenter01

No comments:

Post a Comment