Script to assign PVS boot ISO to XenServer VM’s

In a large PVS environment it’s a time consuming task to assign a boot ISO to all VM’s. Here is a script to assing one ISO to all VM’s in a Xenserver farm

From xenserver console, just paste the following script:

echo Setting PVS boot ISO on all VMs
VMLIST=`xe vm-list | grep "uuid ( RO) " | awk '{print $5}'`
for VM in $VMLIST
echo Ejecting existing ISO on $VM
xe vm-cd-eject vm=$VM
echo Inserting PVSBOOT.ISO to $VM
xe vm-cd-insert cd-name=pvsboot.iso vm=$VM

Warning, this script will insert the iso file to all vm’s in the xenserver farm. If you have other vm’s than PVS devices in the xenserver, please remove the ISO from those after the script is complete or use another script for this task.

The script will also try to assign ISO to the DOM0, but this will just give an error message you can ignore. (I wonder if this maybe ejects the physical CD on the host, I don’t know as my lab Xenserver is virtual, let me know if you find out)

You can also automate it using batch or vb or powershell. Here is the XenCenter command line to use
“c:Program Files (x86)CitrixXenCenterxe.exe” -s xenserverip -u root -pw password vm-cd-eject vm=computername
“c:Program Files (x86)CitrixXenCenterxe.exe” -s xenserverip -u root -pw password vm-cd-insert cd-name=pvsboot.iso vm=computername

5 thoughts on “Script to assign PVS boot ISO to XenServer VM’s

  1. Any script doing forced restart of “dead” vm’s in XenServer? E.g. with state “XenServer tools not installed”. This happens from time to time in a PVS environment. Maybe also email report / sms notification.

  2. We have problem with PVS server are dead when they restart some times. Here is the output for this command:
    [[email protected] ~]# xe vm-param-get uuid=73fd79da-049a-857b-cf94-0ce758c54400 param-name=other-config
    last_shutdown_time: 20121130T01:06:34Z;
    last_shutdown_action: Destroy;
    last_shutdown_initiator: internal;
    last_shutdown_reason: halted;
    uncooperative: false;
    import_task: OpaqueRef:abbd89cc-1f90-5a0c-4b4e-a269d5d3678f;
    mac_seed: f74163d9-7edc-5bc5-1ddd-c04193f98c0b;
    instant: true;
    application_template: 1;
    install-methods: cdrom

Leave a Reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>