VMware ESXi Datastore: Download ISO to datastore directly using CLI

VMware ESXi Datastore

VMware ESXi Datastore

Have you ever been working on an ESXi Server remotely and need to download an ISO of a few gigabytes to the Datastore?
Let’s say you want to install a Windows Server, you will need to get the ISO Image from Microsoft to your PC and then upload that to the Datastore using the GUI. These ISO images are quite big and what is the point of getting it to your PC if the end place is the datastore right?


If you don’t have a fast connection, downloading and then uploading an ISO image of 6.5 GB (Like Windows 2016) will take some time and you are the mercy of the connection failing and having to start all over again!!.
Even if you have a fast link, there has to be a way to do this faster and better! Well we have the trick for you.
Deploying and Installing Virtual Machines remotely is just one of the several DevOps services our specialist engineers provide, so we are always trying to get better and faster doing it.

The answer is the good, old and reliable SSH

Fortunately the VMware GUI allows us to enable SSH on the ESXi itself, so that would help quite a lot.
A WARNING though, we don’t recommend leaving SSH open on the ESXi, even if you have a strong password, so allow SSH as shown below, and then disable it again when you have finished downloading the ISO image.

Enable SSH on ESXi Host

To Enable SSH on the ESXi Host, open your favourite browser and type the IP address of your ESXi. After you logged in, then select the Host and Actions->Services->Enable Secure Shell (SSH)

Enable SSH on the ESXi Host

Now that you have enabled SSH (if you have a firewall in front of the VMWare ESXi, remember to allow traffic on port 22), you can access it using SSH (if you run Linux/Mac) or Putty if you are in Windows:

ssh root@1.2.3.4

Download the image to your local datastore on your ESXi

After you have successfullly logged in you can change to the datastore location typing:

cd /vmfs/volumes/datastore1/

In this case our Datastore is datastore1, but that depends on your environment so change accordingly.

Find the URL link for your ISO Image ā€“ In this example Iā€™m going to download a Windows Server 2016 image (http://software-download.microsoft.com/download/pr/Windows_Server_2016_Datacenter_EVAL_en-us_14393_refresh.ISO)

Go to the terminal and type;

wget -c http://software-download.microsoft.com/download/pr/Windows_Server_2016_Datacenter_EVAL_en-us_14393_refresh.ISO

Your ISO should now be downloading into your datastore1 storage.

To confirm the download has completed, go to your esxi datastore1 using the vmware web client ā€“ you should see the Windows ISO.

Windows ISO

You can now mount the ISO during VM creation, so you have saved some time and hard disk space on your PC! You are welcome šŸ™‚