Manage usergroups with powershell

Resolved

Manage usergroups with powershell

avatar

Hi,

I have RDM Enterprise and I have users and user groups here:

I can add users from Powershell with New-RDMUser cmdlet, and manage users with GET-RDMUser and Set-RDMUser, and Remove-RDMUser. But I can't find any cmdlet to manage User Groups. I have serveral User Groups created here, and I need to manage hundreds of users and assign them to proper groups, and it will be a pain do that in User interface. There is a GET-RDMSecuritygroup cmdlet but when I run it, it shows no group. And I can't find any suitable cmdlet for this.

Can anyone point me in the right direction?

All Comments (8)

avatar

Hello,

The cmdlets to manage the user groups are Get-RDMRole/Set-RDMRole. To assign users to user groups, the cmdlet Set-RDMRoleGroupRights and Set-RDMUserGroupRights will do the trick.

Let us know if you have further questions about these cmdlets.

Best regards,

Érica Poirier

avatar

Thanks for the answer.

Set-RDMRoleRights is not a cmdlet available in my environment, I have Set-RDMRoleGroupRights

I have read the help and examples of those cmdlets and I still don't know how to assign users to groups. Lets say get-rdmuser shows:

User1

User2

User3

And Get-RDMRole

Group1

Group2

Which command do I need to use to assign User1 to Group2 and User2 and User3 to Group1?

avatar

Hello,

Thank you for your feedback.

I want to apologize that I sent you on the wrong path. Those 2 cmdlets are for Security Groups and not User Groups.

The cmdlet you are looking for is Add-RDMRoleToUser.

Here is how you can use this cmdlet.

$user = Get-RDMUser -Name "User1"
$role = Get-RDMRole -Name "Group2"
Add-RDMRoleToUser -RoleObject $role -UserObject $user
Set-RDMUser $user

There are some other cmdlets to manage the user's role membership, and also access to vaults.

  • Remove-RDMRoleToUser

  • Add-RDMRoleVaultAccess

  • Get-RDMRoleVaultAccess

  • Remove-RDMRoleRepositoryAccess

Let us know if you have further questions.

Best regards,

Érica Poirier

avatar

Thank you!!

avatar

One last question: Is it possible to get a list of users in a User group and a list of groups to which a user belongs?