xe.exe CommandLine Interface

A XenServer can be managed with the xe Commandline Interface (CLI). Which can be run locally at the command prompt of the XenServer Console within XenCenter.
The ex.exe is also part of the XenCenter installation and allows and administrator to remotely manage a XenServer from the command prompt of the Windows desktop. With the CLI you can easily script some of the common tasks to perform on a XenServer.

Each xe.exe command starts with the connection settings for the XenServer (Pool Master), followed by the specific command(s) to be performed.
 

C:\Program Files\Citrix\XenCenter>xe.exe -s [xenserver] -u [user] -pw [password] [xe-commands]

 
Which uses the following syntax:

  • xenserver: ip-address or name of the XenServer (or Pool Master).
  • user: name of account used to connect to the XenServer.
  • password: password of the used account.
  • xe-commands: the commands to be performed after the connection to the XenServer (Pool Master) is made.

The rest of this post contains some examples of the different xe-commands that can be used.
 

* List all XenServers in a Pool:

C:\Program Files\Citrix\XenCenter>xe.exe -s [xenserver] -u [user] -pw [password] host-list

 
Gives a list of all XenServers (host) and their uuid.

 

* Remove a dead XenServer from a Pool:

C:\Program Files\Citrix\XenCenter>xe.exe -s [xenserver] -u [user] -pw [password] host-forget uuid=[host-uuid]

 
Which uses the following additional syntax:

  • host-uuid: uuid of the XenServer that is to be removed from the pool.

 

* Lists all VM’s on a host, except for the Control Domain:

C:\Program Files\Citrix\XenCenter>xe.exe -s [xenserver] -u [user] -pw [password] vm-list resident-on=[host-uuid] is-control-domain=false

 
Which uses the following additional syntax:

  • host-uuid: uuid of the XenServer that is checked for existing VMs.

 

* Force a VM to be turned off:

C:\Program Files\Citrix\XenCenter>xe.exe -s [xenserver] -u [user] -pw [password] vm-reset-powerstate uuid=[vm-uuid] -force

 
Which uses the following additional syntax:

  • vm-uuid: uuid of the VM that is forced to shut down.

 

* Copy a VM (using an existing VM):

C:\Program Files\Citrix\XenCenter>xe.exe -s [xenserver] -u [user] -pw [password] vm-copy new-name-label=[new-vm-name] vm=[template-vm-name]

 
Which uses the following additional syntax:

  • new-vm-name: name to asign to the newly created VM.
  • template-vm-name: name of the VM used to be cloned/copied.

 

* Create a new disk for a specified VM:

C:\Program Files\Citrix\XenCenter>xe.exe -s [xenserver] -u [user] -pw [password] vm-disk-add disk-size=[disk-size-bytes] device=[allowed-vbd-devices] sr-uuid=[sr-uuid] vm=[vm-name]

 
Which uses the following additional syntax:

  • disk-size-bytes: size of the new disk (bytes).
  • allowed-vbd-devices: value between 0 and 15.
  • sr-uuid: can be found with the sr-list command.
  • vm-name: name-label of the vm.

 

This article was originally posted at Jan 16, 2010 @ 15:00 *** Last update: Added new CLI commands. ***

Esther Barthel
Solutions Architect at cognition IT

Esther has been working in different roles and functions as an IT consultant ever since she finished her Masters degree in Computer Science in 1997. She has worked as a web developer, database administrator, and server administrator until she discovered how Server-Based Computing ( SBC ) combined servers, desktops, and user experience in one solution. Esther has been specializing in virtualization solutions such as SBC, VDI, application, and server virtualization for over eight years now and is currently working as a Senior Consultant at PepperByte, where she designs and implements Citrix® solutions for both small-business and large-enterprise infrastructures scaling from 100 to 15,000 users.
In january 2014 her first book Citrix XenApp 6.5 Expert Cookbook was published by Packt Publishing.

Esther is awarded as a Citrix Technology Professional (CTP) from 2015 - 2017.
Esther is awarded as a Microsoft Most Valuable Professional (MVP) in 2017.

Esther is a Citrix Certified Expert – Virtualization (CCE-V), Citrix Certified Professional – Mobility (CCP-M), Citrix Certified Professional – Networking (CCP-N) and RES Software Certified Professional (RCP).

Tagged on: ,