How to Manage User Roles with PowerShell
Last updated on March 1, 2021.
Last Reviewed and Approved on PENDING REVIEW
This document describes the step-by-step instructions from end to end managing assigning users enrolled in RPS to specific roles in RPS.
How to Add a local/domain user to RPS Role using PowerShell cmdlets
Import the RPS API module
Import-Module C:\ContentStore\Modules\Rps-Api
Get a user from RPS
$userAdmin = Get-RpsUser -UserName Admin -DomainName Company
Get a RPS Role
Parameter options for the Get-RpsRole cmdlet are:
Parameter Name Type Description Id Guid- Optional Id of Role to retrieve. Name String- Optional Name of Role to retrieve. Empty Retrieve all roles. $role = Get-RpsRole -Name Patch Admin
Add a user to a role
Parameter options for the Add-RpsRoleAssignment cmdlet are:
Parameter Name Type Description User User- Required User to be assigned to role. Role Role- Required Role to have user assigned. $role = Add-RpsRoleAssignment -user $userAdmin -role $role
Note
After the user is added to the role, they will have all the rights and privileges associated with that role
How to Remove a local/domain user from RPS Role using PowerShell cmdlets
Import the RPS API module
Import-Module C:\ContentStore\Modules\Rps-Api
Get a user from RPS
$userAdmin = Get-RpsUser -UserName Admin -DomainName Company
Get a RPS Role
Parameter options for the Get-RpsRole cmdlet are:
Parameter Name Type Description Id Guid- Optional Id of Role to retrieve. Name String- Optional Name of Role to retrieve. Empty Retrieve all roles. $role = Get-RpsRole -Name Patch Admin
Remove a user from a role
Parameter options for the Remove-RpsRoleAssignment cmdlet are:
Parameter Name Type Description User User- Required User to be removed from role. Role Role- Required Role to have user removed from. $role = Remove-RpsRoleAssignment -user $userAdmin -role $role
Warning
After the user is no longer in the role, they will immediately lose all rights and privileges associated with that role