Installing a VIB via PowerCLI

I’ve been rebuilding part of my home lab and trying to really not use Windows servers, so no update manager for me. Which means when it comes time to install a VIB, I can use lots of different mechanisms. I could turn on SSH and use ESXCLI, use the VMA or PowerCLI. Since I still have that installed on my Windows 7 VM, I figured that is the easiest for now. Unfortunately, there were no clear up examples out there of: I have a VIB on X Datastore -> Go install it! So I wrote out a little code and it works like a charm!

Essentially I connect to my home lab, get all of my hosts in ‘Cluster’ and then install my VIB from the VIBPath. It took all of 5 minutes vs. lots of manual typing. For those wondering, I was installing the Synology NFS VIB.

Connect-VIServer VC.home.lab
ForEach ($esxHost in (Get-Cluster “Cluster” | Get-VMHost))
$esxcli = Get-EsxCli -VMhost $esxHost