Export (0) Print
Expand All

Add-RoleMember cmdlet

Add a member to the specified role of an Analysis Services tabular or multidimensional database.

Add-RoleMember [-MemberName] <System.String> [-Database] <System.String> [-RoleName] <System.String> [<CommonParameters>]

Add-RoleMember [-MemberName] <System.String> [-DatabaseRole] <Microsoft.AnalysisServices.Role> [<CommonParameters>]

The Add-RoleMember cmdlet adds a valid member to an existing database role. Only database roles are allowed. You cannot use this cmdlet to add members to a server role.

You can only add one member at a time, which can be either a user or group account.

-MemberName <string>

Specifies the Windows user or group to be added to the role.

Required?

true

Position?

0

Default value

Accept pipeline input?

false

Accept wildcard characters?

false

-Database <string>

Specifies the database to which the role belongs.

Required?

true

Position?

1

Default value

Accept pipeline input?

false

Accept wildcard characters?

false

-RoleName <string>

Specifies the role to which you are adding members.

Required?

true

Position?

2

Default value

Accept pipeline input?

false

Accept wildcard characters?

false

-DatabaseRole <string>

Specifies the Microsoft.AnalysisServices.Role object to which the member should be added. Use this parameter as an alternative to the –Database and –RoleName parameters, when you want to provide the database role via pipeline.

Required?

true

Position?

named

Default value

Accept pipeline input?

true (ByPropertyName)

Accept wildcard characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see About_CommonParameters.

The input type is the type of the objects that you can pipe to the cmdlet. The return type is the type of the objects that the cmdlet returns.

Inputs

None.

Outputs

None

PS SQLSERVER:\sqlas\localhost\default> add-rolemember –membername “adventure-works\bobh” –database “AdventureWorks” –rolename “Reader”

This command adds a Windows domain user account to the Reader role, for the AdventureWorks database running on a local default instance.

PS SQLSERVER:\sqlas\localhost\default> $roles= dir .\databases\AWTEST\RolesPS SQLSERVER:\sqlas\localhost\default> $rolesPS SQLSERVER:\sqlas\localhost\default> add-rolemember –membername:“adventure-works\bobh” –databaserole:$roles[0]

Line 1 adds all of the database roles of the AWTEST database to the pipeline. Line 2, where you type $roles at the prompt, shows the array of roles. Line 3 adds Windows user adventure-works\bobh as a member of the first role in the array.

PS SQLSERVER:\sqlas\localhost\default\Databases\AWTEST\Roles> $roles=dirPS SQLSERVER:\sqlas\localhost\default\Databases\AWTEST\Roles> $roles[0] | Add-rolemember –membername “adventure-works\bobh”

This command adds a Windows domain user account to the first role in an array, where the array is created by listing the children of the Roles folder, in the context of a specific database (AWTEST).

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft