Add-RoleMember cmdlet
Add a member to the specified role of an Analysis Services tabular or multidimensional database.
-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.
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).