Richard Parmiter

Virtualisation blog and Knowledge Base

  • You are here: 
  • Home
  • xencenter

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

Name-of-VM1

Name-of-VM2

Name-of-VM3

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.

Tags: , , , , , ,
Filed under Citrix XenServer, Scripts/Reg | No Comments »

Ads

Ads