Being a fan of scripting but still being what i’d consider a novice any tool that assists with figuring out how it all works is gold IMHO. enter VMware Onyx. This is a fling from VMware. If you are not familiar with VMware Flings look here. Flings are basically cool things built by folks at VMware to make your life easier! Onyx acts as a proxy between the VI client and vCenter. So all operations you do in the VI client are recorded and exposed in Onyx. Here is the official description:
“Onyx is a standalone application that serves as a proxy between the vSphere Client and the vCenter Server. It monitors the network communication between them and translates it into an executable PowerShell code. Later, this code could be modified and saved into a reusable function or script.”
I had reason to use it lately so here’s a quick tutorial on how to use Onyx:
First off download the latest version from the VMware Fling site here
Extract and run Onyx.exe
Click the Orange Star at the top left to begin
In the start new connection dialog enter you vCenter Server address and tick “Launch a client after connected”. Choose your client (In my case I will use the VI client, you can also choose powercli) and enter a valid username and password and click Start.
Your Vi client will automatically launch and you will notice that the IP address/Name that it is connecting to is a URL. This is how the proxy works. It is redirecting all traffic through Onyx.
Once you VI client opens Click the “Play” button in Onyx to start the session
All (well most!) operations that you perform in the VI client will be captured in Onyx so you can grab the code. As an example I created a vDS portgroup called OnyxTest and you can see the output below