Monday 13 July 2020

Code Capture - Developer Center

From vSphere 6.7 onwards VMware introduced a section called the Developer Center where it provides a location for you to browse through the API structure and understand how to call and use the API. There is a section called "Code Capture" where once you set it up you can record your steps that you perform in GUI and then it will translate those steps to code.

In vSphere 6.7 you could only get PowerCLI but with vSphere 7.0 you can have PowerCLI, vRO Javascript, Python, and Go. The following steps are not available for recording - roles, privileges, tags, content libraries, storage policies and passwords at present.

How to get started?
  • In vSphere click on Menu and select Developer Center
  • Select Code Capture tab and if you have not enabled code capture before then you should see the screen below. Click on the slider to enable code capture
  • Once you have enabled code capture you should see the start record button and also on the top right you should see a record icon button. At this point you can either press start record button or navigate to where you want to record and then press the record icon button. The record icon should flash and change as you are recording.
  • Once you have finished press the record icon on the top right and it should bring you back to the code capture screen where you can see the code in PowerCLI for creating a datacenter. To view the code in a different language click on PowerCLI
  • Now you can see that the code is in Javascript
  • You can now copy or download the code to be used. As you have now enabled code capture you can capture the code anytime by pressing the record icon on the top right of the screen. You will get the prompt below when you first do it and you can select the option to not show the warning again
This is a great little tool to help you capture what commands are needed to achieve some of the tasks that you would like to use code to perform for you. It may not be the perfect code but for me at least I can see what cmdlet was used to perform some of the task to give me an idea.
Just to reiterated the following steps are not available for recording - roles, privileges, tags, content libraries and storage policies at present and passwords are not recorded either.

Wednesday 1 July 2020

Rolling back a version of ESXi

There is an option in VMware where after you have performed an major upgrade of ESXi you can roll back to your previous version. The benefit of this is that you would not need to reinstall your ESXi and its configuration if you had issues with the new software. I had to do this on one occassion in my lab where I upgraded from 6.5 to 6.7 and my VMs would not run because the CPU was not supported in 6.7. Please remember if you are using ISO method to upgrade ESXi please ensure you select "Upgrade ESXi, preserve VMFS datastore". Selecting "Install ESXi, preserve VMFS datastore" does not mean preserving datastore means retaining ESXi as it will still do a clean install of ESXi. This method does not work for vSphere 7.0 as there are changes to the partitions on the boot device.


Below are the steps to roll back to a previous version which is quite straight forward. As always perform an backup of your host configuration before you upgrade or rollback (KB2042141). I have tested roll back where I have performed the upgrade via update manager, CLI upgrade and via ISO.

How do you access the recovery menu?

You may have noticed this screen when you boot up your ESXi host

On your keyboard press "Shift + R" which will take you to the recovery menu before the automatic boot counter times out.

As you can see on this recovery menu we have nothing to roll back as I have not updated the host as yet.

Now go through your chosen method of upgrade for your host and then next time at boot up menu go into the recovery menu (Shift + R) you should see a screen similar like below
You can see the default hypervisor is set as 6.7 and the available ESXi version we can roll back to is 6.5. So press Y" to confirm you wish to roll back and remember it will not prompt again to confirm so make sure that you wish to roll back.

ESXi will reboot and you will be back to your previous installed version.

Its a nice feature for a quick rollback if you had issues with upgrades but don't leave it too long after an upgrade for rollbacks.





New Azure KMS IP and domain Addresses for activation

For Windows virtual machines deployed into Azure using marketplace images you may have created rules in your NSG or firewalls to allow the s...