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.bsky.social | @*protected email*) (@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
Steve says
The scrip works well on v7, but I get errors on v6.5
William Lam says
Do you see "History" tab in your VCSA 6.5? I suspect not and this feature was probably introduced in vSphere 7.0 🙂
Steve says
I realized that after I posted 🙂