Set-User

Last updated 10 months ago

Sets the Sitecore user properties.

Syntax

Set-User [-Identity] <AccountIdentity> [-IsAdministrator <Boolean>] [-Portrait <String>] [-Email <String>] [-FullName <String>] [-Comment <String>] [-ProfileItemId <ID>] [-StartUrl <String>] [-Enabled] [-CustomProperties <Hashtable>]

Set-User -Instance <User> [-IsAdministrator <Boolean>] [-Portrait <String>] [-Email <String>] [-FullName <String>] [-Comment <String>] [-ProfileItemId <ID>] [-StartUrl <String>] [-Enabled] [-CustomProperties <Hashtable>]

Detailed Description

The Set-User command sets a user profile properties in Sitecore.

The Identity parameter specifies the Sitecore user to set. You can specify a user by its local name or fully qualified name.

© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-IsAdministrator <Boolean>

Specifies whether the Sitecore user should be classified as an Administrator.

Aliases

​

Required?

false

Position?

named

Default Value

​

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Portrait <String>

Specifies the Sitecore user portrait image.

Aliases

​

Required?

false

Position?

named

Default Value

​

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Identity <AccountIdentity>

Specifies the Sitecore user by providing one of the following values.

Local Name
Example: admin
​
Fully Qualified Name
Example: sitecore\admi

Aliases

​

Required?

true

Position?

1

Default Value

​

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-Instance <User>

Aliases

​

Required?

true

Position?

named

Default Value

​

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-Email <String>

Specifies the Sitecore user email address. The value is validated for a properly formatted address.

Aliases

​

Required?

false

Position?

named

Default Value

​

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-FullName <String>

Aliases

​

Required?

false

Position?

named

Default Value

​

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Comment <String>

Aliases

​

Required?

false

Position?

named

Default Value

​

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-ProfileItemId <ID>

Specifies the profile id to use for the user.

Aliases

​

Required?

false

Position?

named

Default Value

​

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-StartUrl <String>

Specifies the url to navigate to once the user is logged in. The values are validated with a pretermined set.

Aliases

​

Required?

false

Position?

named

Default Value

​

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Enabled <SwitchParameter>

Specifies whether the Sitecore user should be enabled.

Aliases

​

Required?

false

Position?

named

Default Value

​

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-CustomProperties <Hashtable>

Specifies a hashtable of custom properties to assign to the Sitecore user profile.

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.

Sitecore.Security.Accounts.User Represents the instance of a user.

Outputs

The output type is the type of the objects that the cmdlet emits.

  • None.

Notes

Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE 1

PS master:\> Set-User -Identity michael -Email michaellwest@gmail.com

EXAMPLE 2

PS master:\> "michael","adam","mike" | Set-User -Enable $false

EXAMPLE 3

PS master:\> Get-User -Filter * | Set-User -Comment "Sitecore user"

EXAMPLE 4

PS master:\> Set-User -Identity michael -CustomProperties @{"Date"=(Get-Date)}
PS master:\>(Get-User michael).Profile.GetCustomProperty("Date")
​
7/3/2014 4:40:02 PM

EXAMPLE 5

PS master:\> Set-User -Identity michael -IsAdministrator $true -CustomProperties @{"HireDate"="03/17/2010"}
PS master:\>$user = Get-User -Identity michael
PS master:\>$user.Profile.GetCustomProperty("HireDate")
​
03/17/2010

Related Topics