Example Code

Programmatically Add Existing TestStand User to User Group Using LabVIEW

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW
  • Teststand

Code and Documents

Attachment

Overview

 This example adds an existing TestStand user to an existing User Group such as Administrator, Operator, or Technician.  This example also demonstrates how to generate a list of users and user groups using the TestStand API

 

Description

This example uses the TestStand API to add an existing user to a user group.  The example implements the following tasks

 

  • Access the list of users and use groups using the Engine.UsersFile.UserList and Engine.UsersFile.UserGroupList.  These properties are arrays of PropertyObjects, and can be iterated using the GetPropertyObjectByOffset method
  • Add the user to the group using Engine.GetUserGroup("group").Members.SetValStringByOffset(0,1,"UserName")
  • Save the changes to the Users using Engine.UsersFile.AsPropertyObjectFile.WriteFile()

 

Hardware and Software Requirements

TestStand 2014 or Compatible

LabVIEW 2014 or Compatible

 

Steps to Implement or Execute Code

  1. Extract the attached archive, and open the Add Existing User To Group.vi.
  2. Run the VI.  Observe that the dropdowns contain a list of users and user groups on the system.
  3. Select a user and a group, and click the "Add User" button to add the user to the group.
  4. Open the sequence editor, and verify that the change is shown.

 

 
Regards,

Anjelica W.
National Instruments
Product Marketing Manager
FlexLogger and TestStand

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.