Richard Parmiter

Virtualisation blog and Knowledge Base

  • You are here: 
  • Home
  • use xe.exe to start/shutdown vm’s on XenServer

use xe.exe to start/shutdown vm’s on XenServer

Posted on July 27th, 2010

I wanted to stress test a Citrix XenServer 5.6 computer to see how it copes with a number of simultaneou startup and shutdown requests.

I also wanted to see the IOPS passed to back end storage where the virtual machine hard drives are stored.

Rather than manually selecting the machine in XenCenter and shutting down or starting I wrote a script to perform the same action which made it a little quicker and easier when performing this task many times.

I wanted to perform the actions on a specific list of vm’s listed in a text file

List of VM’s – vm.txt




Remember they are case sensitive and the same name you see in XenCenter. It can also be acheived with UUID’s of the VM’s but this is less friendly, so the names were used.

Startup VM’s

This is a simply dos batch script

set XenServer=[server name or IP]
set XenUser=[username]
set XenUserPwd=[password]

for /F %%1 in (vm.txt) do (
start “start %%1” “c:\program files (x86)\Citrix\XenCenter\xe.exe” -s %XenServer% -u %XenUser% -pw %XenUserPwd% vm-start name-label=%%1

I have used the start command to open a seperate dos box for each VM so they are done in parallel. Without this the command waits for each VM to start before starting the next one. Running them all in parallel is *much* better for a stress test of a boot storm simulation!

Shutdown VM’s

set XenServer=[server name or IP]
set XenUser=[username]
set XenUserPwd=[password]

for /F %%1 in (vm.txt) do (
start “shutdown %%1” “c:\program files (x86)\Citrix\XenCenter\xe.exe” -s %XenServer% -u %XenUser% -pw %XenUserPwd% vm-shutdown name-label=%%1

I will no doubt be working on some updates to these scripts in the near future and will share them soon.

  • Digg
  • StumbleUpon
  • Facebook
  • Yahoo! Buzz
  • Twitter
  • Google Bookmarks
  • Add to favorites
  • FriendFeed
  • Google Buzz
  • LinkedIn
  • Live
  • MySpace
  • Reddit
  • RSS

Tags: , , , , , ,
Filed under Citrix XenServer, Scripts/Reg |

One Response to “use xe.exe to start/shutdown vm’s on XenServer”

  1. Arpit Bhargava Says:
    February 7th, 2017 at 4:58 pm

    Hi Richard,

    I work as a technician in a school.

    I am trying to shutdown all my vm’s excluding the server which hosts all the vms and the datastore.

    To make it simple.

    EPH-SR-DATASTORE which host the Vms.
    EPH-SR-USX04 which host the datastore.

    EPH-SR-XEN04 which host EPH-SR-USX04.

    I would like to shutdown down above in sequence starting from top to bottom. VDI first and then disconnect the datastore from USX04 server and then shutdown the usx04 and finally eph-sr-xen04.

    Can your above script accomplish this? If yes how can i go about doing this? Please can you help?


Leave a Reply