Getting the List of TestStand Users Programmatically

Updated Mar 15, 2023



  • TestStand 2016 SP1
  • TestStand 2016
  • TestStand 2014 SP1

I would like to programmatically access the TestStand list of users on a test station, in order to get the number of configured users or the name of each user.  Where can I find this information?

Using TestStand API, you can programmatically get the list of users and access each user's attributes by calling the following API expressions:
  1. Call RunState.Engine.UsersFile.UserList property, which returns the reference to an array of Users, each belonging to Property Object class. 
  2. Call RunState.Engine.UsersFile.UserList.GetNumElements() method to get the number of configured users.
  3. Call GetPropertyObjectByOffset  method to access each User object individually, passing an offset value which corresponds to the index of the array element you need to get. 
  4. For example, to retrieve the name of the first user in the TestStand users list, you can call the following expression: RunState.Engine.UsersFile.UserList.GetPropertyObjectByOffset(0,0).Name

Additional Information

You can also place GetPropertyObjectByOffset  method  in a loop, incrementing the offset parameter at each iteration of the loop, in order to loop though the entire array of users.