XenServer Virtual Machine ISO Management
Updated: Nov 2, 2020
Originally I had written a script to eject all ISOs from every VM that has an ISO attached as well as insert an ISO into every VM in a XenServer pool. The purpose was to assist in attaching a boot ISO to Provisioning Services (PVS) Target Devices, or removing the ISO image from all VMs in a pool. I have updated the script to provide more functionality, namely to assist in transitioning away from PVS boot ISOs to network boot using TFTP, and back again if you need to roll back for any reason. Below are the features of the updated script:
List VMs with an ISO attached in a XenServer pool.
List VMs with no ISO attached in a XenServer pool.
Eject all ISOs and set the VMs to network boot in XenServer pool. Only VMs with ISOs will be affected.
Insert an ISO and set the VMs to boot from ISO in a XenServer pool. Only VMs with no ISO will be affected.
Eject all ISOs from all VMs in a XenServer pool.
Insert an ISO to all VMs in a XenServer pool. Only VMs with no ISO will be affected.
Normally, to transition from ISO boot to network TFTP boot, you need to remove the boot ISO and then set the boot order on the VM to network. Instead of thousands of clicks for hundreds of desktops, this script automates this task. It will search all VMs with ISOs attached, eject the ISO, and switch the boot device to network. Warning, this script does this for every VM in the pool that has an ISO attached. So, if you have some VMs that you don’t want this to run against, make sure to remove any ISO attached to them. If for some reason, a VM does get altered, its an easy fix through XenCenter GUI to set the correct boot device and attach an ISO if so desired. As part of any migration, a roll back plan is always necessary, and this script delivers. If for some reason you need to roll back to a boot ISO, this script will set the boot device to the ISO as well as insert a named ISO into every VM that does not have an ISO attached. Again, please be cautious if you have other VMs that you don’t want to alter by adding an ISO to them or change them back after the script finishes.
During a XenServer upgrade, the upgrade process likes all ISOs to be ejected from all VMs in the XenServer pool. If you only have a few servers, going to each one in XenCenter is not a big deal. But, what if you have a lot of VMs that you need to eject the ISO from ahead of time? This script automates the process, so you don’t have to go to each VM and figure out if there is an ISO attached and eject if found. I recently used this as part of a XenServer 5.6 FP1 to 6.2 upgrade which worked flawlessly.
Upload the script to a XenServer host using WinSCP (or some other method) to /usr/local/bin (or whatever other location you want).
From the XenServer CLI type the following to allow execution of the script
3. From the XenServer CLI type the following to run the script
4. Once the script executes, you will see the following menu:
This post was written in reference to the following platforms and versions:
XenServer 5.6 FP1 – 6.2 SP1.