Link

#Import-Module VMware.VimAutomation.Core
#如果使用 6.5.0 之前版本,需要先导入模块

Connect-VIServer -Server 192.168.1.1
#连接vCenter

$vibpath1 = "/vmfs/volumes/vsandatastore/drivers/lsi-mr3-7.705.10.00-1OEM.670.0.0.8169922.x86_64.vib"


$selectedlocation="Cluster1"
#此处可以设置 Datacenter 名称或者 Cluster 名称以限制范围


$VMHostlist = Get-VMHost -location $selectedlocation | Sort-Object

foreach ($VMHost in $VMHostlist){

    Write-host "Preparing $($vmhost.Name) for ESXCLI" -ForegroundColor Yellow

    $ESXCLI = Get-EsxCli -VMHost $VMHost

    
    Write-host "Installing VIB on $($vmhost.Name)" -ForegroundColor Yellow
    $action = $ESXCLI.software.vib.install($null,$null,$null,$null,$null,$true,$null,$null,$vibpath1)
    # 安装 vib
    
    if ($action.Message -eq "Operation finished successfully."){Write-host "Action Completed successfully on $($vmhost.Name)" -ForegroundColor Green} else {Write-host $action.Message -ForegroundColor Red}
    # 检查 vib 是否安装成功
}


参考链接:

https://davidstamen.com/2016/03/03/using-powercli-to-install-host-vibs/