Remove-RoleMember cmdlet
Remove a member from the specified role of an Analysis Services database.
Syntax
Remove-RoleMember [-MemberName] <System.String> [-Database] <System.String> [-RoleName] <System.String> [<CommonParameters>]
Remove-RoleMember [-DatabaseRole] <Microsoft.AnalysisServices.Role> [-MemberName] <System.String> [<CommonParameters>]
Description
The Remove-RoleMember cmdlet removes an existing member from a role of an Analysis Services database.
Parameters
-MemberName <string>
Specifies the Windows user or group to be removed from 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 from which you are removing members.
Required? |
true |
Position? |
2 |
Default value |
|
Accept pipeline input? |
false |
Accept wildcard characters? |
false |
-DatabaseRole <string>
Specifies the Microsoft.AnalysisServices.Role object from which the member is being removed. 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.
Inputs and Outputs
None.
Example 1
PS SQLSERVER:\sqlas\localhost\default> remove-rolemember –membername “adventure-works\bobh” –database “AdventureWorks” –rolename “Reader”
This command removes a Windows domain user account from the Reader role, for the AdventureWorks database running on a local default instance.
Example 2
PS SQLSERVER:\sqlas\localhost\default> $roles= dir .\databases\AWTEST\Roles
PS SQLSERVER:\sqlas\localhost\default> $roles
PS SQLSERVER:\sqlas\localhost\default> remove-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 removes the Windows user “adventure-works\bobh” from the first role in the array.
Example 3
PS SQLSERVER:\sqlas\localhost\default\Databases\AWTEST\Roles> $roles=dir
PS SQLSERVER:\sqlas\localhost\default\Databases\AWTEST\Roles> $roles[0] | Remove-rolemember –membername “adventure-works\bobh”
This command removes a Windows domain user account from 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).