Set-User
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-2019 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
Text
Required?
false
Position?
named
Default Value
​
Accept Pipeline Input?
false
Accept Wildcard Characters?
false

-Portrait <String>

Specifies the Sitecore user portrait image.
Aliases
Text
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.
1
Local Name
2
Example: admin
3
​
4
Fully Qualified Name
5
Example: sitecore\admi
Copied!
Aliases
Text
Required?
true
Position?
1
Default Value
​
Accept Pipeline Input?
true (ByValue)
Accept Wildcard Characters?
false

-Instance <User>

Aliases
Text
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
Text
Required?
false
Position?
named
Default Value
​
Accept Pipeline Input?
false
Accept Wildcard Characters?
false

-FullName <String>

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

-Comment <String>

Aliases
Text
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
Text
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
Text
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
Text
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
Text
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

1
PS master:\> Set-User -Identity michael -Email [email protected].com
Copied!

EXAMPLE 2

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

EXAMPLE 3

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

EXAMPLE 4

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

EXAMPLE 5

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

Related Topics