Vihostupdate

From Peter Pap's Technowiki
Jump to: navigation, search

The vihostupdate command, as the name suggests, is used for performing updates/patching on existing systems.


Usage

In order to find out the command line arguments you can use with this command, do:

 vihostupdate --help


Query the ESXi server

This command will allow you to see what patches, if any, have been deployed on your server at the present time:

 vihostupdate --username adminuser --password adminpassword --server hostname/IP --query

If you omit the username and pasword, you will be prompted for them when you run the command.


List the patches in a patch bundle

ESXi patches come in a zip file that can contain a large number of patches. You can choose to install any one or all of them. In order to see what patches are in a given patch bundle, do the following:

 vihostupdate --username adminuser --password adminpassword --server hostname/IP --bundle bundlefilename --list

Yes, it still needs you to point it to a server! Here's an example and output:

 vihostupdate --username root --password XXXXXXXX --server 192.168.X.X --bundle update-from-esxi4.1-4.1_update02.zip --list
 
 ---------Bulletin ID---------   ----------------Summary-----------------
 ESXi410-Update02                VMware ESXi 4.1 Complete Update 2       
 ESXi410-201110202-UG            Updates ESXi 4.1 VMware Tools           
 ESXi410-201110201-SG            Updates ESXi 4.1 Firmware

You can use the Bulletin ID'd shown here to install individual patches.

Installing a patch bundle

First, make sure you have downloaded the right patch for the right server. If you're running ESXi, make sure it's an ESXi patch, not an ESX patch!!! Second, the server will need to be in maintenance mode (I use the GUI client to do this). Then, to install an entire patch bundle:

 vihostupdate --username adminuser --password adminpassword --server hostname/IP --bundle bundlefilename --install

For example:

 vihostupdate --username root --password XXXXXXXX --server 192.168.X.X --bundle update-from-esxi4.1-4.1_update02.zip --install
 Please wait patch installation is in progress ...
 The update completed successfully, but the system needs to be rebooted for the changes to be effective.

Then reboot your server and run the query command above to see which if any of the patches have been installed:

 vihostupdate --username root --password XXXXXXX --server 192.168.X.X --query
 ---------Bulletin ID--------- -----Installed----- ----------------Summary-----------------
 ESXi410-Update02              2011-12-21T08:21:52 VMware ESXi 4.1 Complete Update 2

Installing an individual patch from a bundle

If you want to install just one patch from a bundle:

 vihostupdate --username adminuser --password adminpassword --server hostname/IP --bundle bundlefilename --bulletin bulletinID --install

Use the Bulletin ID from the list that the bundle contains.