WilliamLam.com

  • About
    • About
    • Privacy
  • VMware Cloud
  • Tanzu
    • Application Modernization
    • Tanzu services
    • Tanzu Community Edition
    • Tanzu Kubernetes Grid
    • vSphere with Tanzu
  • Home Lab
  • Nested Virtualization
  • Apple
You are here: Home / Automation / How to programmatically retrieve vCenter Server Patch & Update History?

How to programmatically retrieve vCenter Server Patch & Update History?

10.08.2021 by William Lam // 3 Comments

Homelab just upgraded successfully to vSphere 7.0 Update 3!

I really appreciate the “History” view to be able to see all the updates/patches that have been applied for your vCenter Server. Its the little things pic.twitter.com/Go9eicpeSp

— William Lam (@lamw) October 7, 2021

After upgrading my homelab to the latest vSphere 7.0 Update 3 release, I was just looking at the "History" tab within the Virtual Machine Management Interface (VAMI), which gives you a historical view of all the patches and updates that have been applied to your vCenter Server since its initial deployment. I am not exactly sure when this was feature was introduced, but it can definitely be useful for both auditing but also debugging/troubleshooting purposes.

Of course, I was curious about this information and wanted to see if I could retrieve it using something like PowerCLI. However when I started to look for the API, I realized that there may not be a public API for this ... but that did not stopped me and taking a look at Chrome Developer, I quickly saw the endpoint which was /rest/appliance/update/history and I was able to figure out a workaround giving the same data.

Below are two examples on accessing this data using either PowerShell or cURL

PowerShell

$VAMI_USERNAME="FILL_ME_IN"
$VAMI_PASSWORD="FILL_ME_IN"
$VCSA_HOSTNAME="vcsa.primp-industries.local"

$pair = "${VAMI_USERNAME}:${VAMI_PASSWORD}"
$bytes = [System.Text.Encoding]::ASCII.GetBytes($pair)
$base64 = [System.Convert]::ToBase64String($bytes)
$basicAuthValue = "Basic $base64"

$headers = @{
    "authorization"="$basicAuthValue"
    "Content-Type"="application/json"
    "Accept"="application/json"
}

$uri = "https://${VCSA_HOSTNAME}:5480/rest/appliance/update/history"

$results = Invoke-WebRequest -Uri $uri -Method GET -Headers $headers -UseBasicParsing -SkipCertificateCheck
$jsonResults = ($results.Content | ConvertFrom-Json).Value

cURL

VAMI_USERNAME=FILL_ME_IN
VAMI_PASSWORD=FILL_ME_IN
VCSA_HOSTNAME="vcsa.primp-industries.local"

curl -s -k -u ${VAMI_USERNAME}:${VAMI_PASSWORD} https://${VCSA_HOSTNAME}:5480/rest/appliance/update/history | jq

 

More from my site

  • Quick Tip - Automating allowed and not allowed Datastores for use with vSphere Cluster Services (vCLS)
  • How to configure Hardware Compatibility List (HCL) database for vSphere Lifecycle Manager (vLCM) in an air-gapped environment?
  • How to automate checking for new vCenter Server updates in vSphere Lifecycle Manager (vLCM)?
  • Quick Tip - Downloading ESXi Image (ISO or ZIP) from vSphere Lifecycle Manager (vLCM)
  • vSphere ESXi 7.x will be last version to officially support Apple macOS Virtualization

Categories // Automation, PowerCLI, VCSA, vSphere 7.0 Tags // vSphere 7.0

Comments

  1. Steve says

    10/11/2021 at 7:24 am

    The scrip works well on v7, but I get errors on v6.5

    Reply
    • William Lam says

      10/11/2021 at 2:03 pm

      Do you see "History" tab in your VCSA 6.5? I suspect not and this feature was probably introduced in vSphere 7.0 🙂

      Reply
      • Steve says

        10/12/2021 at 7:12 am

        I realized that after I posted 🙂

        Reply

Thanks for the comment! Cancel reply

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

Search

Author

William Lam is a Senior Staff Solution Architect working in the VMware Cloud team within the Cloud Infrastructure Business Group (CIBG) at VMware. He focuses on Cloud Native technologies, Automation, Integration and Operation for the VMware Cloud based Software Defined Datacenters (SDDC)

Connect

  • Email
  • GitHub
  • LinkedIn
  • RSS
  • Twitter
  • Vimeo

Recent

  • Changing the default HTTP(s) Reverse Proxy Ports on ESXi 8.0 03/22/2023
  • Quick Tip - How to download ESXi ISO image for all releases including patch updates? 03/15/2023
  • SSD with multiple NVMe namespaces for VMware Homelab 03/14/2023
  • Is my vSphere Cluster managed by vSphere Lifecycle Manager (vLCM) as a Desired Image or Baseline? 03/10/2023
  • Interesting VMware Homelab Kits for 2023 03/08/2023

Advertisment

Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy

Copyright WilliamLam.com © 2023

 

Loading Comments...