Archives

This is actually a script I built to test out various things at once. I was testing (and learning) how the vRealize Automation REST API calls work. There are other good resources on the web for getting started. While not a vRealize Automation example, I enjoyed this blog entry on Python and vSphere REST API calls with Python. Between that, and the official documention, and some Postman experimentation, I was able to get things going.

Everyone has simple scripts they use to get through their day, I’m sure. The following scenario deals with having a large list (as provided in a .csv) of VMs needing to be migrated to a different datastore cluster. When dealing with multiple migrations, Storage DRS doesn’t update as quickly as one would like. Therefore, the current LUN with the most space can quite quickly be pushed to capacity. Thus, in this script we sort all of the LUNS by the amount of free space, grab the top 10 with the most free space, and randomly pick a lun to migrate the next VM.

For our own purposes, we prefer to make sure all the .vmdks are eager zeroed. So just in case, we transform any potential non-thick provisioned eager zeroed disk.

Had a few requests that stayed within the system even though the builds failed. This led to repeated attempts by vRA to expire items that didn’t exist. Got together with VMware Tech Support and learned this handy method of clearing these requests up.