I recently came across a really cool project called vmw-cli which was built by Andrew Obersnel, an Engineer who works over in our Network and Security Business Unit (NSBU) at VMware. This CLI tool enables you to login to MyVMware and based on your entitlements, download any VMware binary or application just like you would using a web browser but now you can completely automate it from the command-line! The CLI is written as a Node.js application and you can consume as a CLI which requires Node.js to be installed or you can just run it as a Docker Container.
UPDATE (01/24/22): There is now a new VMware Customer Connect CLI (vcc) that is OSS as part of the VMware Labs Github repo. For more details on how to use this new CLI, please check out the README in the repo.
In the example below, I will take you through on how to use vmw-cli using the Node.js CLI method. If you prefer to use the Docker Container, you can simply refer to the Github project page for more details.
Step 1 - To get started, you will need to first install Node.js. Next, you can install vmw-cli using the following npm command:
npm install vmw-cli --global
By default, the CLI will be installed under .npm-global/bin/ directory and you will probably want to update your PATH variable to include this additional path if you do not already. For Linux or MacOS systems, you can simply run the following (which temporally updates your PATH variable):
export PATH=$PATH:~/.npm-global/bin/
Step 2 - Next, we need to set up two additional environmental variables which contains the username and password you use to login to MyVMware. For Linux or MacOS systems, you can run the following command:
export VMWUSER='<userid>'
export VMWPASS='<password>'
Step 3 - To confirm that everything is working, we can run the "list" command which will simply list the top level products from MyVMware.
vmw-cli list
The output is exactly what you would see if you were simply browsing https://vmware.com/download page.
To be able to download using vmw-cli, you will need to first generate an index for a given product. For products like vSphere which contains a large number of releases, the indexing can take some time. In my environment, it took exactly 10 minutes to index the "VMware vSphere" product which you can do by running the following command:
vmw-cli index vmware-vsphere
Note: For those interested, the JSON index file is located in ./.npm-global/lib/node_modules/vmw-cli/lib/fileIndex.json
Once the indexing has completed, you can then download a specific file given the filename and you can even use vmw-cli to perform a search. In my opinion, the easiest way to find the file name is to actually use MyVMware site from web browser. For example, highlighted below is the filename for the latest version of the ESXi 6.7 ISO.
Once you have the filename, simply run the "get" command as shown below to start the download.
vmw-cli get VMware-VMvisor-Installer-6.7.0-8169922.x86_64.iso
This is definitely a handy tool to have around and it is something I have a seen customers ask about before. Thanks Andrew for developing this solution and If you have any feedback or feature enhancements, feel free to leave a comment on his Github project page.
Brad Calvert (@BlueArcher) says
Now if only there were an API for the license portal!
William Lam says
Couldn't agree more! Anything in particular you were looking for in terms of functionality for license portal or how you might use the API for a given use case?
Brad Calvert (@BlueArcher) says
We are a very large shop with a double digit number of divisions and HPP purchasing. I would really love to put some automation around combining, dividing, and moving keys between folders, and retrieving keys by product/folder/annotation value, to start. Longer term I would like to build an internal portal to receive basic vCenter and host license requests, have someone approve it, have it create the key (dividing off of a large unallocated key, for example), apply specific annotations to the key (cluster name, vCenter, location, requestor name, etc), and then move the key to an existing folder for that division to give the appropriate employees access.
At first I thought maybe putting automation around HPP purchases, but maybe that isn't a good idea, HAH.
At our scale , it is quite difficult to keep the license portal clean looking and auditable with the number of people that need access. Oh, and we have a shocking number of VMware accounts 🙁
Nick says
I think this is a great start but have a suggestion for an improvement. I would like to be able to automatically pull the latest patch of a product (e.g. ESXi 6.5). Maybe even have it keep a cache of the last version I downloaded so the next time I run it, searching for the same product, it will automatically download if there is a newer patch available or state "No new patches" if not. I have an aggressive patching cycle on some of my networks and it would make my life much easier to automate the checking of new patches for all the VMware products I use.
David Chung (@dchung615) says
Would like to see license management API. Split/Combine/Upgrade and get licenses. 😉