Set-SPUser
Configures properties of an existing user.
Syntax
Set-SPUser
[-Identity] <SPUserPipeBind>
[-AddPermissionLevel <String[]>]
[-AssignmentCollection <SPAssignmentCollection>]
[-ClearPermissions]
[-Confirm]
[-DisplayName <String>]
[-Email <String>]
[-Group <SPGroupPipeBind>]
[-IsSiteCollectionAdmin]
[-PassThru]
[-RemovePermissionLevel <String[]>]
[-SyncFromAD]
[-Web <SPWebPipeBind>]
[-WhatIf]
[<CommonParameters>]
Description
The Set-SPUser
cmdlet configures properties of an existing user.
For permissions and the most current information about Windows PowerShell for SharePoint Products, see the online documentation at SharePoint Server Cmdlets.
Examples
------------------EXAMPLE 1-----------------------
Set-SPUser -Identity 'Contoso\jdoe' -Web https://intranet.contoso.com -AddPermissionLevel "Contributor"
This example sets a user (Contoso\jdoe) to be a contributor on https://intranet.contoso.com.
------------------EXAMPLE 2-----------------------
Set-SPUser -Identity 'Contoso\jdoe' -Web https://intranet.contoso.com -SyncFromAD
This updates the User Information List for the user 'contoso\jdoe' with the current displayName
and mail
attribute values from the user's Active Directory account.
Parameters
-AddPermissionLevel
Specifies the permission level to add to the user.
The value must be one of the following options:
--Contribute
Can view, add, update and delete list items and documents.
--Design
Can view, add, update, delete, approve and customize documents.
--Full Control
Has full control for all documents.
--Limited Access
Can view specific lists, document libraries, list items, folders, or documents when permissions are granted.
--Read
Can view pages and list items and download documents.
Type: | String[] |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Applies to: | SharePoint Server 2010, SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019 |
-AssignmentCollection
Manages objects for the purpose of proper disposal. Use of objects, such as SPWeb or SPSite, can use large amounts of memory and use of these objects in Windows PowerShell scripts requires proper memory management. Using the SPAssignment object, you can assign objects to a variable and dispose of the objects after they are needed to free up memory. When SPWeb, SPSite, or SPSiteAdministration objects are used, the objects are automatically disposed of if an assignment collection or the Global parameter is not used.
When the Global parameter is used, all objects are contained in the global store.
If objects are not immediately used, or disposed of by using the Stop-SPAssignment
command, an out-of-memory scenario can occur.
Type: | SPAssignmentCollection |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
Applies to: | SharePoint Server 2010, SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019 |
-ClearPermissions
Deletes all assigned permissions from the user. If Clear and Add values exist, permissions are first cleared and then new permissions are added.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Applies to: | SharePoint Server 2010, SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019 |
-Confirm
Prompts you for confirmation before executing the command.
For more information, type the following command: get-help about_commonparameters
Type: | SwitchParameter |
Aliases: | cf |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Applies to: | SharePoint Server 2010, SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019 |
-DisplayName
Specifies the new display name of the user.
The type must be a valid name.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Applies to: | SharePoint Server 2010, SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019 |
Specifies the new email address of the user.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Applies to: | SharePoint Server 2010, SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019 |
-Group
Adds the user to an existing group in the given site.
Type: | SPGroupPipeBind |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Applies to: | SharePoint Server 2010, SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019 |
-Identity
Specifies the GUID, login name, or SPUser object of the user to be returned.
The type must be a GUID of an existing user in the form, 1234-5678-9876-0987.
Type: | SPUserPipeBind |
Aliases: | UserAlias |
Position: | 1 |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
Applies to: | SharePoint Server 2010, SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019 |
-IsSiteCollectionAdmin
Specifies whether to set the user as a site collection administrator.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Applies to: | SharePoint Server 2010, SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019 |
-PassThru
If not provided, indicates that this cmdlet has no output. If provided, this parameter indicates that the SPUser object for this user is to be returned.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Applies to: | SharePoint Server 2010, SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019 |
-RemovePermissionLevel
Removes the permission level from the user.
Type: | String[] |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Applies to: | SharePoint Server 2010, SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019 |
-SyncFromAD
If provided, specifies that user information will be synchronized from the user directory store. This switch only retrieves the displayName
and mail
value from the directory store. It supports Active Directory (Classic or Windows authentication), Forms-based Authentication, and SAML. FBA and SAML providers must support resolving from their directory store for this switch to work. The switch only supports SharePoint User objects.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Applies to: | SharePoint Server 2010, SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019 |
-Web
Specifies the name of the URL or GUID to be used as a scope. This parameter is not needed if the SPUser object is provided as the identity.
The value must be an authentic URL, in the form https://server_name, or GUID, in the form 1234-5678-9807.
Type: | SPWebPipeBind |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
Applies to: | SharePoint Server 2010, SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019 |
-WhatIf
Displays a message that describes the effect of the command instead of executing the command.
For more information, type the following command: get-help about_commonparameters
Type: | SwitchParameter |
Aliases: | wi |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Applies to: | SharePoint Server 2010, SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019 |