Listing allowed VLANs on uplinks (vmnic) of ESXi 5.1 hosts

ESXi 5.1 has the ability to show  allowed VLANs on  physical NICs (vmnic). By default this option is not enabled on NICs. We have to enable explicitly and gather the VLAN details. Please find the script below which will help you to enable the VLAN STATS on the NICs which have the LINK status UP.