PowerCLI: Update host from ESXi 5.1 to 5.1 update 1

From VI-Toolkit
Jump to: navigation, search

Rolling updates

author: Alan Renouf

Description

Here Alan shows how you can update your hosts using PowerCLI

Usage

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
$esxcli.software.vib.install("/vmfs/volumes/datastore1/Update-from-esxi5.1-5.1-update1.zip",$false,$true,$true,$false,$false)

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")

Location

http://www.virtu-al.net/2013/07/24/updating-from-esxi-5-1-to-esxi-5-1-update1-with-powercli/