Connect ISO to VM the PowerCLI way
I recently bought a new server for my home lab, or at least, it was the start of my home lab. After my ESX host crashed two years ago I didn’t took the time to rebuild it.
As I started to rebuild every single VM on my host I quickly became somewhat irritated by the fact that I had to switch to the vSphere client to mount an ISO and then back to my RDP session to do the installation.
I thought to myself “This should be easier. Why isn’t there a tool that can list the ISO’s on the datastores and give you the choice to mount one of them?”.
Well, here it is. I created a PowerCLI script that does just that. From within the virtual machine it retrieves all ISO files on all datastores, pops up a dialog and lets you choose and mount an ISO.
For the script to work you need permission on vCenter to list files on the datastores and to mount the ISO on your current VM. You also need PowerCLI (still thinking about trying this in Visual Basic if I get irritated enough). It was tested on PowerCLI 4.1.1 on ESX 4.1
Start the script in a PowerCLI window and start selecting ISO files. Since connecting to vCenter takes a while it’s probably better not to close the PowerCLI window until you don’t have to switch ISO files.
Disclaimer: Part of the script is based on work by @LucD22. There is no guarantee this script will work in your infrastructure. There is no guarantee the script doesn’t break anything. I tested it in my own lab and for me it works and it didn’t destroy my lab.
- PowerShell Friday: Load PowerCLI from your own script by Anne Jan Elsinga
- VMware Fling – PowerActions for vSphere Web Client by Erik Scholten
- PowerShell Friday: Connecting to vCenter by Anne Jan Elsinga
- Setup the vRealize Automation prerequisites for IaaS by Erik Scholten
- PowerShell Friday: Snapshots by Anne Jan Elsinga
Anne Jan Elsinga
Anne Jan Elsinga is a Technical Account Manager for VMware. In the past he worked as presales and technical consultancy and architecture for several systems integrators. From 2009 until 2017 he was awarded with the VMware vExpert status. In the night time he dances latin, ballroom and salsa and he also discovered the pleasure of diving and woodworking. Recently he started blogging about smart homes and comfort in general.