In the latest release of vCenter (6.7U2 and higher) you will find a feature called Developer Center Code Capture.
If you are familiar with VMware flings you might know about the Onyx fling which was a similar project.
The idea of a developer center was first released in the VMware on AWS Cloud console. As the tool is highly popular VMware decided to add it to the vSphere client as well.
With code capture we get the possibility to record our actions in the vSphere client and output those actions as code.
You can use this code for instance to reproduce these actions for automating tasks and making your live as an administrator or developer easier.
The code that is being recorded and outputted is in a form of PowerCLI called “low-level PowerCLI”. Instead of the familiar high-level cmdlets like Get-CIVAPP or Get-VM the output is .Net based and can be used directly to interact with the vSphere API.
In this blog I will show you what you can do with the Developer Center Code Capture feature.
Enable code capture
As a first step I need to enable the code capture feature in the vSphere client.
Once I have enabled the code center I can start recording actions in vCenter.
For this demo I will clone a demo VM and record the code output to see what we get. Therefore I have created a VM called ‘vblog-arjen’ before hand.
To start recording I need to click the record button that has appeared since I enabled the Code capture feature. (The button can be found in the top right corner of the vSphere client)
The next step for me is to actually perform the action of cloning a VM and see what happens.
Once I am done with the clone operation I pressed the record button again to stop recording.
As soon as I hit stop I am taken back to the Developer center and the code is presented to me.
As you can see I have the option to clear and start another action or to copy and or download the code.
Proof that the captured code works
For the purpose of this blog post I have copied the code and I will now try to redo my clone action using PowerCLI.
But first things first, I have to delete the cloned VM.
Now I can run the code and see what happens.
And there we have it succes. I hope you enjoyed reading this post and found it useful.
Other interesting automation related articles:
- vCloud automation tools
- Deploy a vApp using PowerCLI
- The basics of vcd-cli
- vCloud PowerCLI/PowerShell basics
I was inspired to write this blog post after reading about vSphere Client Developer Center on https://blogs.vmware.com/
75 total views, 3 views today