powershell 在vCenter中的所有主机上下载并安装ESXi Host Client
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了powershell 在vCenter中的所有主机上下载并安装ESXi Host Client相关的知识,希望对你有一定的参考价值。
Connect-viserver 10.160.200.218 -user administrator@vsphere.local -Password "Admin!23"
Write-Host "Downloading latest Host Client VIB" -ForegroundColor Green
$source = "http://download3.vmware.com/software/vmw-tools/esxui/esxui_signed.vib"
$Vib = "$ENV:Temp" + "\esxui_signed.vib"
Invoke-WebRequest $source -OutFile $Vib
$Vibname = $vib.split("\")[-1]
Get-VMHost | Foreach {
Write-host "Installing ESXUI on $($_)" -ForegroundColor Green
$datastore = $_ | Get-Datastore | Where {-Not $_.ExtensionData.Summary.MultipleHostAccess -and $_.Extensiondata.Info.vmfs} | Sort FreespaceGB -Descending | Select -first 1
If (-not $Datastore) {
Write-Host "Local Datastore not found trying any with space" -ForegroundColor Green
$datastore = $_ | Get-Datastore | Sort FreespaceGB -Descending | Select -first 1
}
$remoteLocation = "/vmfs/volumes/" + $datastore + "/" + $Vibname
$Psdrive = New-PSDrive -name "VIBDS" -Root \ -PSProvider VimDatastore -Datastore $datastore
Write-Host "..Copying file to $datastore" -ForegroundColor Green
$CopyVIB = Copy-Datastoreitem $VIB -Destination VIBDS:
Write-host "..Installing VIB on $($_)" -ForegroundColor Green
$esxcli = Get-EsxCli -VMHost $_
$esxcli.software.vib.install($null,$false,$true,$false,$false,$true,$null,$null,$remotelocation)
Write-Host "Host Client Installed, removing install file from $datastore" -ForegroundColor Green
Get-childitem "$($psdrive.Name):\esxui_signed.vib" | Remove-Item
Remove-PSDrive -name VIBDS -Confirm:$false
}
以上是关于powershell 在vCenter中的所有主机上下载并安装ESXi Host Client的主要内容,如果未能解决你的问题,请参考以下文章
PowerCLI 通过vCenter批量更改所有的esxi主机名称和DNS
PowerCLI 通过vCenter主机时间与所有虚拟机时间进行同步
PowerCLI 通过vCenter主机时间与所有虚拟机时间进行同步
PowerCLI 通过vCenter主机时间与所有虚拟机时间进行同步
PowerCLI 通过vCenter批量更改所有或者单一台esxi主机root密码
PowerCLI 通过vCenter批量更改所有或者单一台esxi主机root密码