Get-Role
Returns one or more Sitecore roles using the specified criteria.

Syntax

Get-Role [-Identity] <AccountIdentity>
Get-Role -Filter <String>

Detailed Description

The Get-Role command returns one or more Sitecore roles using the specified criteria.
The Identity parameter specifies the Sitecore role to get. You can specify a role by its local name or fully qualified name. You can also specify role object variable, such as lt;role>.
To search for and retrieve more than one role, use the Filter parameter.
© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Identity <AccountIdentity>

Specifies the Sitecore role by providing one of the following values.
1
Local Name
2
Example: developer
3
Fully Qualified Name
4
Example: sitecore\developer
Copied!
Aliases
​
Required?
true
Position?
1
Default Value
​
Accept Pipeline Input?
true (ByValue)
Accept Wildcard Characters?
false

-Filter <String>

Specifies a simple pattern to match Sitecore roles.
Examples: The following examples show how to use the filter syntax.
To get all the roles, use the asterisk wildcard: Get-Role -Filter *
To get all the roles in a domain use the following command: Get-Role -Filter "sitecore*"
Aliases
​
Required?
true
Position?
named
Default Value
​
Accept Pipeline Input?
false
Accept Wildcard Characters?
false

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.
  • System.String
    Represents the identity of a role.

Outputs

The output type is the type of the objects that the cmdlet emits.
  • Sitecore.Security.Accounts.Role
    Returns one or more roles.

Notes

Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE 1

1
PS master:\> Get-Role -Identity sitecore\developer
2
​
3
Name Domain IsEveryone
4
---- ------ ----------
5
sitecore\developer sitecore False
Copied!

EXAMPLE 2

1
PS master:\> "sitecore\developer","sitecore\author" | Get-Role
2
​
3
Name Domain IsEveryone
4
---- ------ ----------
5
sitecore\author sitecore False
6
sitecore\developer sitecore False
Copied!

EXAMPLE 3

1
PS master:\> Get-Role -Filter sitecore\d*
2
​
3
Name Domain IsEveryone
4
---- ------ ----------
5
sitecore\Designer sitecore False
6
sitecore\Developer sitecore False
Copied!

EXAMPLE 4

Expand the MemberOf property to see a list of roles that the specified role is a member.
1
PS master:\> Get-Role -Identity sitecore\developer | Select-Object -ExpandProperty MemberOf
2
​
3
Name Domain IsEveryone
4
---- ------ ----------
5
sitecore\Sitecore Client Configuring sitecore False
6
sitecore\Sitecore Client Developing sitecore False
7
sitecore\Designer sitecore False
8
sitecore\Author sitecore False
9
sitecore\Sitecore Client Maintaining sitecore False
Copied!

Related Topics