How To – Use PowerCLI to list installed patches

Continuing on with the VMware PowerCLI theme, if you don’t use vCenter Server with Update Manager to manage your host(s) and you need to determine what patches have been applied then you can do this easily via a simple PowerCLI command.

For those of you that don’t know what PowerCLI is, it is simply a bunch of PowerShell cmdlets to manage vSphere resources. There are heaps of cool things you can do with vSphere PowerCLI, including installing patches themselves. If you want to know how to do this, then simply follow the instructions in this post.

To run vSphere PowerCLI you will need to install the correct version, depending on the host(s) you are wanting to manage. You can find the install files on the VMware website, but I have attached some links below to make things easier for you…

Once it has installed successfully you can launch it from the Start menu. This will launch a PowerShell like command-line interface. From here you can run all standard PowerShell cmdlets as well as the PowerCLI specific ones.

Now that you have installed vSphere PowerCLI and ran it successfully, lets find what updates you have installed:

1. First we need to connect to host you want to check. To do this, run the following command (replacing with the name or ip address of your host):


Connect-ViServer –Server 

2. Next we run the Get-View cmdlet passing a number of parameters and then finally selecting the appropriate results we want to display…


Get-View -ViewType HostSystem -Property Name, Config.Product | Select Name,{$_.Config.Product.FullName},{$_.Config.Product.Build} | ft -auto

And that is pretty much it!

Enjoy 🙂
Luca

Comments

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.