PowerCLI: Get ESX version info


image

If you want a quick overview of your ESX servers, you can run the following script:

$vCenter = Read-Host "Enter the vCenter server name"

Connect-VIServer $vCenter

$vmhosts = get-vmhost * 
$vmhosts | Sort Name -Descending | % { $server = $_ |get-view; `
    $server.Config.Product | select `
    @{ Name = "Server Name"; Expression ={ $server.Name }}, `
    Name, Version, Build, FullName, ApiVersion }

Disconnect-VIServer -Confirm:$false
 

The output looks like this:

image

Advertisements

2 thoughts on “PowerCLI: Get ESX version info

  1. Alan Renouf

    Now what you need to do is read the htm file from the VMware website and correspond the version numbers to actual versions 😉 Something I was thinking about doing a while back.

    Reply
    1. laez

      That would be cool, but very unlogical at the same time. Since your buildnumbers increase with every update you do on ESX.

      If you install the “bare-ISO” then you will have the default build that is indeed displayed on the download page on the VMware website. But after every installation I immidiately run the updates through the Update Manager plugin to update it with the latest patches/updates before I put any server in production.

      So, that would mean that the script will immidiately stop matching with the latest buildnumber that is available for download on the website because the version that is running in your cluster is actually newer.

      What would be a better option, which I considered myself is to put all the versions of all servers in a cluster in an array and take the highest buildnumber (the server with the latest updates) and display which servers are running behind with updates.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s