Add-RoleMember

Adds a member to a specific Role of a specific database.
Add-RoleMember [-MemberName*] <System.String> [-Database*] <System.String> [-RoleName*] <System.String>[<CommonParameters>]
Add-RoleMember -Database*Role <Microsoft.AnalysisSevices.Role> [-MemberName*] <System.String> [<CommonParameters>]

The Add-RoleMember cmdlet adds a valid member to a specific Role of a specific database depending upon the input values.

Parameters
-MemberName <System.String>

  • This value is required

Name of the member who should be added to the role.

-Database <System.String>

  • This value is required

Database name to which the Role belongs to.

-RoleName <System.String>

  • This value is required

Name of the Role to which the member should be added.

-DatabaseRole <Microsoft.AnalysisSevices.Role>

Microsoft.AnalysisServices.Role object to which the member should be added.

<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,ErrorAction, ErrorVariable, WarningAction, WarningVariable,OutBuffer, PipelineVariable, and OutVariable.

Outputs

None

Examples
  1. In the above examples all the roles available in Database DB1 are retrieved and stored in a temporary variable roles:
    PS SQLServer:SQLASmachineinstanceDatabasesDB1Roles> $roles=dir
    
                           PS SQLServer:SQLASmachineinstanceDatabasesDB1Roles>$roles[0] | Add-RoleMember 
       -MemberName:"memberName"

    The membername will be added to the first role object available in the roles collection.

  2. In the above example user1 of foo domain is added to the role myRole belonging to database DB1:
    
       Add-RoleMember -MemberName "foouser1" -Database "DB1" -RoleName "myRole"
Additional Notes