Adding VMKernel ports to multiple hosts using PowerCLI

So, yesterday I was asked to quickly put together a script to add VMkernel ports to Multiple ESXi hosts. I have a script to add VM Port groups to multiple host, and this is easy. But the issue with the VMkernel ports is that they require a unique IP address.

So I put together the following CSV and Script

CSV File which includes the below information. Obviously the fields will be changed to suit your network


The PowerCLI script:

Download the CSV (add_vmkernel.csv) and copy the script from above and place in C:\PowerCLI

Browse to PowerCLI from a powershell window and launch .\add_vmkernel.ps1

You will get prompted for root credentials (or not – depending on what you have commented / uncommented in the script above)

The process will continue as below

Once complete, if you browse to the hosts, you will see the port group has been added

 

Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn

Leave a Reply

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

*
*