WilliamLam.com

  • About
    • About
    • Privacy
  • VMware Cloud Foundation
  • VKS
  • Homelab
    • Resources
    • Nested Virtualization
  • VMware Nostalgia
  • Apple
You are here: Home / Automation / vSphere Code Capture is your ChatGPT for vSphere Automation

vSphere Code Capture is your ChatGPT for vSphere Automation

11.30.2023 by William Lam // 1 Comment

Have you ever tried to automate a specific vSphere operation but were sure which vSphere API to use or if known, how to actually use it? This is something I frequently see and get asked about quite often!

Did you know about this hidden little gem that has been available since vSphere 6.7, built right into the vSphere UI that can help with these questions!?


It is called vSphere Code Capture or what I typically refer to as your ChatGPT for vSphere Automation, but without the hallucinations 😀

Even as someone who is intimately familiar with the vSphere API, vSphere Code Capture is a tool I used on a pretty regular basis whether that is helping a customer with a question or writing a quick script.

vSphere Code Capture is super easy to use, simply navigate to Developer Center->Code Capture and then enable the feature if you have not already and begin recording. It will start capturing all UI operations performed in that session using the vSphere UI. Once you have finished and stopped the recording, you be able to see which vSphere APIs were used but also how they were used along with specific arguments to each API.

The output for vSphere Code Capture includes the following vSphere SDKs: PowerCLI, Aria Orchestrator, Pyvmomi (vSphere SDK for Python) and Govmomi (vSphere SDK for Go), which you can simply toggle via a dropdown to see the output.


While the output can be pretty verbose as it is using the vSphere APIs directly, you can determine the specific vSphere API method being used by looking at the annotated comments. In the example above, I have captured a typical VM reconfiguration workflow which includes changing the CPU, Memory, resizing an existing disk and adding a new disk ... all of which uses the the same vSphere VM API called ReconfigureVM_Task().

Once you know the specific vSphere API methods that are used, then you can search for them by using the vSphere Web Services API Reference documentation to better understand the required parameters and their meaning. Along with the working example provided by vSphere Code Capture, you now have all the information to either create your own script or application for your desired vSphere Automation.

There are some limitations to be aware of when using vSphere Code Capture, such as not being able to capture operations pertaining to vSphere Roles, Privileges, Tags, Content Libraries, and VM Storage Policies which is also mentioned in the vSphere Code Capture documentation. Additionally, not all vSphere functionality is consumable from within the vSphere UI, so those operations would also not be captured. Lastly, any functionality that is exposed via the vSphere Automation (REST) API is currently NOT recorded as part of vSphere Code Capture.

vSphere Code Capture is extremely powerful and can help both new and existing users to quickly ramp up on using the vSphere APIs. I am hopeful that in the future we will also be able to include functionality from the vSphere Automation API, so that this tool can be the go to solution for when users have questions on which or how to automate a specific vSphere operation.

More from my site

  • Updated vSphere Login UI customizations for vSphere 7.x & 8.x
  • Retrieving vCenter Server certificate (Machine, VMCA Root, STS & Trusted Root) details using the vSphere API 
  • Generating a vSphere UI link to a specific Virtual Machine
  • Creating custom ESXi images using vSphere Lifecycle Manager (vLCM) UI and PowerCLI cmdlets for vSphere 8
  • How to restrict vSphere UI access while maintaining vSphere API functionality?

Categories // Automation, vSphere, vSphere Web Client Tags // Code Capture, vSphere API, vSphere UI

Comments

  1. *protectedRichard Pugh says

    12/01/2023 at 9:00 am

    I remember using Onyx for this and wasn’t aware of this capture tool. Thanks for the insight!

    Reply

Leave a Reply to Richard PughCancel reply

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

Search

Thank Author

Author

William is Distinguished Platform Engineering Architect in the VMware Cloud Foundation (VCF) Division at Broadcom. His primary focus is helping customers and partners build, run and operate a modern Private Cloud using the VMware Cloud Foundation (VCF) platform.

Connect

  • Bluesky
  • Email
  • GitHub
  • LinkedIn
  • Mastodon
  • Reddit
  • RSS
  • Twitter
  • Vimeo

Recent

  • Programmatically accessing the Broadcom Compatibility Guide (BCG) 05/06/2025
  • Quick Tip - Validating Broadcom Download Token  05/01/2025
  • Supported chipsets for the USB Network Native Driver for ESXi Fling 04/23/2025
  • vCenter Identity Federation with Authelia 04/16/2025
  • vCenter Server Identity Federation with Kanidm 04/10/2025

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 © 2025

 

Loading Comments...