top of page
  • Writer's pictureChris Keim

XenServer VM Memory Management Bash Script

Updated: Nov 2, 2020

This menu-driven script gives you the ability to manage RAM allocation for multiple VMs at once. I needed to adjust the RAM allocation to 450 virtual desktops. Of course, I could have manually set this or re-deployed the desktops. But, both of those options would take a lot longer than just scripting the process.


  • List all VMs in a XenServer pool with a specified static max setting.

  • Update memory on all VMs within a XenServer pool with a specified static max to a newly specified amount.

  • Preview the changes before making them.

Applicable Products

  • XenServer 5.6 - 6.2


  • Linux Bash


  • When specifying the RAM size to search or update, specify in MB. For example, to search for VMs with 2GB of RAM, you would enter 2048 instead.

  • The script will create a log file in the directory it is run.

  • The update function will update all VMs with the specified memory.

  • The update function will only update VMs that are shutdown (a.k.a halted).

  • Please perform a backup of your XenServer pool metadata prior to running this script.

How To

  1. Download the script and upload to a XenServer host using WinSCP (or some other method) to /usr/local/bin.

  2. Connect to the XenServer host via SSH and enter the following to allow execution of this script:

3. From the XenServer CLI, type the following to run the script:

4. Once the script executes, you will see a menu. To navigate, just type the number option you want and press enter.


242 views0 comments


bottom of page