PowerCLI: Update host from ESXi 5.1 to 5.1 update 1

From VI-Toolkit
Jump to navigation Jump to search

Rolling updates

author: Alan Renouf


Here Alan shows how you can update your hosts using PowerCLI


List hosts and their versions:

Get-VMhost | Select name, ConnectionState, Version, Build

Put the host into maintenance mode so that we can install the patch:

$vmhost = Get-VMhost pod18-esx01a*
$vmhost | Set-VMhost -State Maintenance

Upload the patch to a datastore

$ds = $vmhost | Get-Datastore datastore1*
Copy-DatastoreItem C:\Updates\Update-from-esxi5.1-5.1-update1.zip $ds.datastorebrowserpath -Recurse

Install the patch on the host

$esxcli = Get-Esxcli -VMHost $vmhost

and reboot

Restart-VMhost -VMHost $vmhost -Confirm:$false

Remove the uploaded patch from the datastore

remove-item ($ds.datastorebrowserpath + "\Update-from-esxi5.1-5.1-update1.zip")