ESXi 5.5: Update stand-alone host via PowerCLI

  1. Update Stand-Alone host

 

Step

Process

 

Evacuate / shutdown all VMs

 

Launch PowerCLI or open PowerShell prompt and add the PowerCLI snap-in.

 

Connect to stand-alone host:

  1. Connect-VIServer ESX01
 

Confirm and note current version and build:

  1. $stage=”Before_Update1″
  2. Get-VMHost –Name ESX01 | select name,version,build,@{E={$stage};L=”Stage”} | Export-CSV C:\Temp\ESXi_Update.csv -NoTypeInformation

This will create a txt file with three columns, including the custom stage column.

 

Enter maintenance mode:

  1. Set-VMHost ESX01 –State Maintenance
 

Install updates:

  1. Install-VMHostPatch –VMHost ESX01 –HostPath /vmfs/volumes/datastore1/updates/5.5_update1/metadata.zip
 

Restart the host:

  1. Restart-VMHost –VMHost ESX01 –RunAsync –Confirm:$false
 

Reconnect to stand-alone host:

  1. Connect-VIServer ESX01
 

Compare current version and build:

  1. $stage=”After_Update1″
  2. Get-VMHost –Name ESX01 | select name,version,build,@{E={$stage};L=”Stage”} | Export-CSV C:\Temp\ESXi_Update.csv –NoTypeInformation –Append

Don’t forget –Append or you’ll overwrite the file!

 

Repeat for any other updates you may require. Change $stage to reflect the update stage’.

 

Exit maintenance mode:

  1. Set-VMHost ESX01 –State Connected

 

 

You may have noticed, this method requires copying the file to the ESXi host first. This can be achieved with PowerShell (details bellow), the Datastore Browser or an application such as WinSCP.

 

PowerCLI Copy

Update Source: C:\Temp\ESX\Download (Extracted)

Update Destination: datastore1. (Use Get-Datastore to list available data stores)

Step

Process

 

Set chosen datastore to a variable:

  1. $DS1 = Get-Datastore –Name datastore1
 

Assuming you don’t want the update directory on the root of the datastore. i.e. you want it in a directory named “updates”, set a variable:

  1. $updates = $DS1.DataStoreBrowserPath + “\updates\ESXi550-201404001”

The directory will be created if it doesn’t already exist.

 

Extract the downloaded update ZIP file to a suitable location on your PC. (C:\Temp\ESX\Download\ESXi550-201404001\)

 

Copy the update to the datastore:

  1. Copy-DatastoreItem C:\Temp\ESX\download\ESXi550-201404001\ -Destination $updates
 

The update(s) are now on the ESXi host. Complete the steps given above.

Local Path

It is also possible to run the update with the files remaining on your PC:

  1. Install-VMHostPatch –VMHost ESX01 –LocalPath C:\Temp\ESX\download\ESXi550-201404001\metadata.zip –HostUsername admin –HostPassword *****

 

Reference

https://www.vmware.com/support/developer/PowerCLI/PowerCLI41U1/html/Install-VMHostPatch.html

 

Alternative

An alternative way using esxcli: http://www.v-front.de/2014/03/how-to-update-your-standalone-host-to.html

 

  1. esxcli software vib update -d “/vmfs/volumes/datastore1/updates/ESXi550-201404001.zip”

Please feel free to leave a comment...