Skip to Content
Author's profile photo Jason Everly

Updating your Enterprise users passwords by group

A customer had an issue where they could update all their users passwords at once using a script they already had, but they needed to be able to update user passwords by group instead.

Updating everyone is easy as you just grab every user in your query (you are making sure to exclude the administrator and guest from the query aren’t you?) and loop through them all and set the password to whatever you want.  Simple enough.

Doing so by group is different as you need to get the users specific to that group and the way users and groups are linked in Enterprise makes it more of a challenge.  It takes multiple queries to get the users from your group and then be able to update them.

I created a sample for the customer and am attaching the code.  Essentially it queries for the group you are looking to modify, gets the number of users and dynamically creates the new query to query for all of the users in that group.  You can then loop through those users and modify their passwords.

Here is the code.  You need to make sure to include the CrystalDecisions.Enterprise.Desktop.User and .UserGroups in your references as well.

Good luck!


“) Response.Write(“”) For Each boInfoObject In boInfoObjects boGroup = New UserGroup(boInfoObject.PluginInterface) ‘create a dynamic SQL statement to query for all the groups ‘that the user belongs to. ‘check for users If boGroup.Users.Count > 0 Then strSQL = “SELECT SI_NAME FROM CI_SYSTEMOBJECTS ” strSQL += “WHERE SI_ID = ” + boGroup.Users(1).ToString For s = 2 To boGroup.Users.Count strSQL += ” OR SI_ID = ” + boGroup.Users(s).ToString Next ‘get the groups from the InfoStore. Then loop through and output. boUsers = boInfoStore.Query(strSQL) ‘loop through all users and update their password For Each boUser In boUsers Response.Write(“”) Response.Write(“”) boUserInterface = New User(boUser.PluginInterface) boUserInterface.NewPassword = “newpassword123” Next boInfoStore.Commit(boUsers) Else ‘if no user, just output the group name and a blank Response.Write(“”) Response.Write(“”) End If Next Response.Write(“”) Response.Write(“Passwords of users above have been updated”) End Sub End Class

Group Name User Name
” + boGroup.Properties(“SI_NAME”).ToString + “ ” + boUser.Properties(“SI_NAME”).ToString + “
” + boGroup.Properties(“SI_NAME”).ToString + “  

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.