Automating LoginVSI Load Testing and Performance Capture

I’ve been working on a project recently where I’m going to be performance testing a new environment. As always in projects, timescales can be compressed due to issue and delays.

I’ve worked on automating the performance testing piece so that this can be completed unattended and in a faster space of time.

We need to do a few things during the load testing period.

  • Capture XenServer performance metrics and store in a CSV
  • Capture VM perfmon counters and store in a CSV
  • Ensure all machines are registered with the Citrix Delivery Controller(s)
  • Run the load test
  • End XenServer performance capture
  • End VM perfmon capture
  • Reset the environment before the next load test begins


These scripts are designed to run on your LoginVSI Management server. You will require Citrix Studio installed and a 3rd party module for SSH (will be included in the script pack).

The following diagram is an overview of how the scripts link together:

I’ll split the remainder of the article into separate pieces, XenServer, Perfmon and Load Testing.


XenServer has a web API to capture performance but it’s a bit slow and cumbersome to manage in this particular sense so I’ve gone down the SSH route.

The below process is completed by 3 separate scripts.

XenServer_Performance.ps1 is responsible for running the start of the XenServer monitoring and when the LoginVSI test is complete, firing off the Stop script.

All parameters required are supplied by the main launch script. The script also installs the required SSH module.


A list of servers can be specified for performance monitoring and the counters manually amended within the scripts where necessary.

The performance monitoring script using the PowerShell Get-Counter command, make sure the account you are running the script with is in the “Performance Monitor Users” group of the VM’s being monitored.

The script will start the capturing before the test starts and will stop once the test completes.


The loginVSI test script passes all the necessary parameters to the LoginVSI command line tool.

You must manually generate your performance testing profiles within the LoginVSI console before you can run these scripts.


The wrapper script or main launch script – Initiate_VSI_tests.ps1 is where you populate all your parameters.

This script will pass all required information to other scripts and is responsible for running the loops and ensuring the environment is ready before testing.

It watches the loginVSI log folder for the test to see if there are errors or if it is complete and amends a common logfile to all scripts. This indiciates to the other scripts that are also watching this logfile to stop recording metrics.


The following parameters must be set in the scripts in order for it to all function correctly:

<br />###Common Details Section###<br />[string] $vsishare = "\\loginvsi-01.ctxlab.local\VSI_Share" # \\servername\sharename used a base for other scripts<br />[int] $testDuration = 30 # Number of minutes to run test<br />[string] $desktopGroupName = "PowerScale" # Name of desktop delivery group<br />[int] $testCycles = 3 # Number of cycles for each test<br />[string[]]$testProfiles = "Citrix_Desktop_TW"<br />###Common Details Section###</p>
<p>###LVSI Testing Section###<br />[string] $lvsiScriptLocation = "C:\Scripts\LVSI\Invoke_LVSI_Test.ps1"<br />[string] $DomainName = "ctxlab.local" #Domain of launcher account<br />[string[]] $launchers = "loginvsi-01.ctxlab.local" #server name for LoginVSI launcher machine<br />[string] $VSILogFile = "\\loginvsi-01.ctxlab.local\VSI_Share\My_Logs" # Path to log files \\servername\sharename<br />###LVSI Testing Section###</p>
<p>###XenServer Monitoring Section###<br />[string] $xenScriptLocation = "C:\Scripts\XenServer\XenServer_Performance.ps1" #Xen performance measurement start script<br />[string] $xenStartScript = "C:\Scripts\XenServer\Start-XSMetrics.ps1" #Start monitoring script<br />[string] $xenStopScript = "C:\Scripts\XenServer\Stop-XSMetrics.ps1" #Stop monitoring script<br />[string[]] $xenHostNames = "","","","" #Hostname/IP of the XenServer to monitor<br />[string] $xenServerUsername = "root" #XenServer username<br />[string] $xenServerPassword = "xxxxxxx" # XenServer password<br />###XenServer Monitoring Section###</p>
<p>###VM Perfmon Monitoring###<br />[string] $citrixController = "XDDC-01.ctxlab.local" # Citrix Controller<br />[string] $perScriptLocation = "C:\Scripts\VM_Perfmon\Perfmon.ps1"<br />[string] $additionalMachines = "dc-01.ctxlab.local","loginvsi-01.ctxlab.local"<br />###VM Perfmon Monitoring###<br />


You can download the script pack here.


Daniel Feller –

Logit Blog –

Leave a Reply

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