VMware: Install vSphere 5 update 1 with PowerCLI
Today I’ve updated my vSphere 5 hosts witch patch 1 released one week ago. Before I started the build number was VMware ESXi 5.0.0 469512:
To update the host I used PowerCLI, the code:
Get-VMHost esx02.vmpros.lan | Set-VMHost -State Maintenance $DataStore = Get-VMHost esx02.vmpros.lan | Get-Datastore ESX02_VMFS01 Copy-DatastoreItem C:\vmpros\patch1\ $DataStore.DatastoreBrowserPath -Recurse Get-VMHost esx02.vmpros.lan | Install-VMHostPatch -Hostpath "/vmfs/volumes/ESX02_VMFS01/patch1/metadata.zip"
The script will upload the content of the update-from-esxi5.0-5.0_update01.zip located at your local computer (which running PowerCLI) to the selected datastore. Then the update installation will start.
Update installation process:
WARNING: The update completed successfully, but the system needs to be rebooted for the changes to be effective.
… reboot the host
The ESXi host is back online, with build number 623860
The update is succeeded!
To patch multiple servers at once, you can run the following script:
$ESXiHost01 = "esx01.vmpros.lan" $ESXiHost02 = "esx02.vmpros.lan" $ESXiHost03 = "esx03.vmpros.lan" Get-VMHost $ESXiHost01,$ESXiHost02,$ESXiHost03 | Set-VMHost -State Maintenance $DataStore = Get-VMHost esx02.vmpros.lan | Get-Datastore ESX02_VMFS01 Copy-DatastoreItem C:\vmpros\patch1\ $DataStore.DatastoreBrowserPath -Recurse Get-VMHost $ESXiHost01,$ESXiHost02,$ESXiHost03 | Install-VMHostPatch -Hostpath "/vmfs/volumes/VMFS01/patch1/metadata.zip"
^ Make sure the update package is placed on central storage
More information about VMHostPatch: VMware
I did this using powerCLI cmdlets for update manager 🙂