Check Your vCenter & ESXi Versions in Seconds (PowerCLI One-Liner Guide)

If you need a quick, reliable way to see which vCenter build you’re on and what versions your ESXi hosts are running, this post is for you. Below is a copy-paste PowerCLI snippet that connects to vCenter, prints the vCenter build, lists every ESXi host with its version/build, and then cleanly disconnects.

Source: I’ve published this as a simple script here:

https://github.com/AngrySysOps/scripts/blob/main/vCenter_And_ESXi_versions.ps1

Prerequisites

  • Windows PowerShell (or PowerShell 7)
  • VMware PowerCLI:
    Open PowerShell as Administrator once and run:
Install-Module VMware.PowerCLI
  • Then, in your session:
Import-Module VMware.PowerCLI


Tip (certs): In lab/dev, if you hit certificate prompts, you can temporarily suppress them:
Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -Confirm:$false

Example output (what “good” looks like)

--- vCenter Server Version ---
Name    : vcenter.angrysysops.com
Version : 8.0.3
Build   : 24022515

--- ESXi Host Versions ---
Name              Version Build
----              ------- -----
esx01.angrysysops.com   8.0.3   24022531
esx02.angrysysops.com   8.0.3   24022531
esx03.angrysysops.com   7.0.3   20328353

🔥 Side Quest for SysAdmins 🔥

I’m building HackMeNow – a terminal-style hacking puzzle game.
Back it on Kickstarter and help bring it to life:


👉 Support HackMeNow on Kickstarter 👈

Handy Variations

Only a specific cluster:

Get-Cluster "DEV-Cluster" | Get-VMHost | Select Name, Version, Build | Sort Name

Group hosts by version (quick compliance view):

Get-VMHost | Group-Object Version | Select Name, Count

Add product names (nice for reports):

Get-VMHost | Select Name,
@{N='Product';E={$_.ExtensionData.Config.Product.FullName}},
@{N='Version';E={$_.Version}},
@{N='Build';E={$_.Build}} | Format-Table -AutoSize

Troubleshooting (quick wins)

  • Cannot connect to vCenter
    • Check reachability/ports (443), DNS, and credentials.
    • Try FQDN and IP to rule out DNS issues.
  • PowerCLI not found
    • Re-run Install-Module VMware.PowerCLI as Administrator.
    • If behind a proxy, configure PowerShell’s proxy or install offline.
  • Certificate warnings
    • Lab/dev: Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -Confirm:$false
    • Prod: install/chain the proper certs instead of ignoring.
  • Access denied / partial results
    • Your vSphere role may lack Host.VIEW privileges. Try with an account that has at least Read-Only at vCenter level.

Note on a common error: If you previously tried something like
Get-View $si.Content.About and saw
“Cannot bind parameter ‘Id’… to type ManagedObjectReference”,
that’s because Get-View expects a MoRef, not the AboutInfo object.
The approach in this post uses DefaultVIServers and Get-VMHost, which is cleaner for version reporting.

Why this matters

  • Audit & compliance: Keep track of mixed versions before patching.
  • Risk reduction: Identify stragglers on older builds.
  • Change prep: Attach the CSV to your change case or CAB notes.

Grab the script

Repo link (kept updated):
https://github.com/AngrySysOps/scripts/blob/main/vCenter_And_ESXi_versions.ps1

ubscribe to the channel: youtube.be/@AngryAdmin 🔥

🚨Dive into my blog: angrysysops.com

🚨Snapshots 101: a.co/d/fJVHo5v

🌐Connect with us:

💻Website: angrysysops.com

🔥vExpert info: vExpert Portal

Please leave the comment