Get-User
Returns one or more Sitecore users using the specified criteria.

Syntax

1
Get-User [-Identity] <AccountIdentity> [-Authenticated]
2
Get-User -Filter <String> [-Authenticated] [-ResultPageSize <Int32>]
3
Get-User -Current
Copied!

Detailed Description

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

Parameters

-Identity <AccountIdentity>

Specifies the Sitecore user by providing one of the following values.
Local Name:
1
admin
Copied!
Fully Qualified Name:
1
sitecore\admin
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 users.
Examples: The following examples show how to use the filter syntax.
To get all the users, use the asterisk wildcard:
1
Get-User -Filter *
Copied!
To get all the users in a domain use the following command:
1
Get-User -Filter "sitecore\*"
Copied!
Aliases
Required?
true
Position?
named
Default Value
Accept Pipeline Input?
false
Accept Wildcard Characters?
false

-Current <SwitchParameter>

Aliases
Required?
true
Position?
named
Default Value
Accept Pipeline Input?
false
Accept Wildcard Characters?
false

-Authenticated <SwitchParameter>

Aliases
Required?
false
Position?
named
Default Value
Accept Pipeline Input?
false
Accept Wildcard Characters?
false

-ResultPageSize <Int32>

Specifies the number of users to retrieve per request to the user provider. Each page of users is written to the pipeline before the next request is made. Without specifying this parameter all accounts are retrieved before passing down the pipeline.
Aliases
Required?
false
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 user.

Outputs

The output type is the type of the objects that the cmdlet emits.
    Sitecore.Security.Accounts.User
    Returns one or more users.

Notes

Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE 1

1
PS master:\> Get-User -Identity admin
2
3
Name Domain IsAdministrator IsAuthenticated
4
---- ------ --------------- ---------------
5
sitecore\admin sitecore True False
Copied!

EXAMPLE 2

1
PS master:\> "admin","michael" | Get-User
2
3
Name Domain IsAdministrator IsAuthenticated
4
---- ------ --------------- ---------------
5
sitecore\Admin sitecore True False
6
sitecore\michael sitecore False False
Copied!

EXAMPLE 3

1
PS master:\> Get-User -Filter *
2
3
Name Domain IsAdministrator IsAuthenticated
4
---- ------ --------------- ---------------
5
default\Anonymous default False False
6
extranet\Anonymous extranet False False
7
sitecore\Admin sitecore True False
8
sitecore\michael sitecore False False
Copied!

EXAMPLE 4

1
PS master:\> Get-User -Filter "[email protected]*.com"
2
3
Name Domain IsAdministrator IsAuthenticated
4
---- ------ --------------- ---------------
5
sitecore\michael sitecore False False
Copied!

EXAMPLE 5

Expand the MemberOf property to see a list of roles that the specified user is a member.
1
PS master:\> Get-User -Identity sitecore\michael | Select-Object -ExpandProperty MemberOf
2
3
Name Domain IsEveryone
4
---- ------ ----------
5
sitecore\PowerShell Extensions Remoting sitecore False
6
sitecore\Developer sitecore False
Copied!

Related Topics

Last modified 11d ago