Wednesday, September 16, 2015

Powercli Get-Esxcli install VIB files

In my earlier blog Using Powercli to copy files from your computer to Esxi server I successfully able to install vib file using plink.exe tool but not through Powercli Get-Esxcli command. after lots of trial and error I have came to conclusion to install plain VIB you will have to use offline bundle only (If anyone knows the solution suggestions are welcome). I have downloaded offline bundle for Esxi web as a zip file and copied it on datastore.

Read my earlier blog for Using Powercli to copy files from your computer to Esxi server
Next is uninstalled the already installed software, I will be removing it using SSH again, my command is kept under c:\temp\command.txt and it contains line
esxcli software vib remove -n esx-ui

Next on the powershell console using plink tool i have executed command.txt on esxi server.
Write-Output "yes" |  plink.exe -ssh root@192.168.33.21 -P 22 -pw Computer@1 -m 'c:\temp\command.txt'

It has given me message operation finished successfully and VIB is removed.
Now we will need to create a esxcli connection to server over powercli.  
$esx =  Get-VMHost 192.168.33.21 | Get-EsxCli
all the session details will be saved in $esx. which can be used later against the connected esxi server.
$esxcli.software.vib.install("/vmfs/volumes/datastore1/esxui-offline-bundle-3023372.zip",$false,$true,$true,$true,$false,$null,$null, $null)

Above command is to install the offline bundle. make sure you are maintaining character caps and small letter while providing offline bundle path. You will get successful message on the server and it will require reboot.
Once i reboot the server and create I connected to esxi server again running connect-viserver, and Created connection to vmhost using esxcli and session is stored in $esx (to verify software is in the list and correctly installed).
$esx.software.vib.list() | ft
Although there is another command to install esxi offline bundle using Install-VMHostPatch, its fairly easy.

No comments: