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):
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:
Step 3 - To confirm that everything is working, we can run the "list" command which will simply list the top level products from MyVMware.
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.
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.