Set-SPUser

配置现有用户的属性。

语法

Default (默认值)

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>]

说明

cmdlet Set-SPUser 配置现有用户的属性。

有关适用于 SharePoint 产品的 Windows PowerShell 的权限和最新信息,请参阅 SharePoint Server cmdlet

示例

示例 1

Set-SPUser -Identity 'Contoso\jdoe' -Web https://intranet.contoso.com -AddPermissionLevel "Contributor"

本示例将用户 (Contoso\jdoe) 设置为 上的https://intranet.contoso.com参与者。

示例 2

Set-SPUser -Identity 'Contoso\jdoe' -Web https://intranet.contoso.com -SyncFromAD

这会使用用户 Active Directory 帐户中的当前 displayName 值和 mail 属性值更新用户“contoso\jdoe”的用户信息列表。

参数

-AddPermissionLevel

适用:SharePoint Server 2010、SharePoint Server 2013、SharePoint Server 2016 SharePoint Server 2019

指定要添加到用户的权限级别。

该值必须是以下选项之一:

--贡献

可以查看、添加、更新和删除列表项和文档。

--设计

可以查看、添加、更新、删除、批准和自定义文档。

--Full Control

对所有文档具有完全控制权。

--受限访问

授予权限后,可以查看特定列表、文档库、列表项、文件夹或文档。

--读

可以查看页面和列表项以及下载文档。

参数属性

类型:

String[]

默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-AssignmentCollection

适用:SharePoint Server 2010、SharePoint Server 2013、SharePoint Server 2016 SharePoint Server 2019

管理对象以便正确进行处理。 使用 SPWeb 或 SPSite 等对象可能会耗用大量内存,而且在 Windows PowerShell 脚本中使用这些对象需要正确管理内存。 通过使用 SPAssignment 对象,可以将对象分配给变量,然后在不需要这些对象时对它们进行处理,以释放内存。 在使用 SPWeb、SPSite 或 SPSiteAdministration 对象时,如果不使用分配集合或 Global 参数,则会自动处理这些对象。

使用全局参数时,所有对象均包含在全局存储中。 如果未立即使用对象,或未通过使用 Stop-SPAssignment 命令来处理对象,则可能会发生内存不足的情况。

参数属性

类型:SPAssignmentCollection
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:True
来自管道的值(按属性名称):False
来自剩余参数的值:False

-ClearPermissions

适用:SharePoint Server 2010、SharePoint Server 2013、SharePoint Server 2016 SharePoint Server 2019

从用户中删除所有分配的权限。 如果存在“清除”和“添加”值,则首先清除权限,然后添加新权限。

参数属性

类型:SwitchParameter
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-Confirm

适用:SharePoint Server 2010、SharePoint Server 2013、SharePoint Server 2016 SharePoint Server 2019

执行命令前,看到确认提示。 有关详细信息,请键入以下命令:get-help about_commonparameters

参数属性

类型:SwitchParameter
默认值:None
支持通配符:False
不显示:False
别名:cf

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-DisplayName

适用:SharePoint Server 2010、SharePoint Server 2013、SharePoint Server 2016 SharePoint Server 2019

指定用户的新显示名称。

类型必须是有效的名称。

参数属性

类型:String
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-Email

适用:SharePoint Server 2010、SharePoint Server 2013、SharePoint Server 2016 SharePoint Server 2019

指定用户的新电子邮件地址。

参数属性

类型:String
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-Group

适用:SharePoint Server 2010、SharePoint Server 2013、SharePoint Server 2016 SharePoint Server 2019

将用户添加到给定站点中的现有组。

参数属性

类型:SPGroupPipeBind
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-Identity

适用:SharePoint Server 2010、SharePoint Server 2013、SharePoint Server 2016 SharePoint Server 2019

指定要返回的用户的 GUID、登录名或 SPUser 对象。

该类型必须是表单 1234-5678-9876-0987 中的现有用户的 GUID。

参数属性

类型:SPUserPipeBind
默认值:None
支持通配符:False
不显示:False
别名:UserAlias

参数集

(All)
Position:1
必需:True
来自管道的值:True
来自管道的值(按属性名称):False
来自剩余参数的值:False

-IsSiteCollectionAdmin

适用:SharePoint Server 2010、SharePoint Server 2013、SharePoint Server 2016 SharePoint Server 2019

指定是否将用户设置为网站集管理员。

参数属性

类型:SwitchParameter
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-PassThru

适用:SharePoint Server 2010、SharePoint Server 2013、SharePoint Server 2016 SharePoint Server 2019

如果未提供,则指示此 cmdlet 没有输出。 如果提供,此参数指示要返回此用户的 SPUser 对象。

参数属性

类型:SwitchParameter
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-RemovePermissionLevel

适用:SharePoint Server 2010、SharePoint Server 2013、SharePoint Server 2016 SharePoint Server 2019

从用户中删除权限级别。

参数属性

类型:

String[]

默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-SyncFromAD

适用:SharePoint Server 2010、SharePoint Server 2013、SharePoint Server 2016 SharePoint Server 2019

如果已提供,则指定将从用户目录存储同步用户信息。 此开关仅从目录存储中检索 displayNamemail 值。 它支持 Active Directory (经典或Windows 身份验证) 、基于Forms的身份验证和 SAML。 FBA 和 SAML 提供程序必须支持从其目录存储进行解析,才能使此开关正常工作。 开关仅支持 SharePoint User 对象。

参数属性

类型:SwitchParameter
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-Web

适用:SharePoint Server 2010、SharePoint Server 2013、SharePoint Server 2016 SharePoint Server 2019

指定要用作范围的 URL 或 GUID 的名称。 如果将 SPUser 对象作为标识提供,则不需要此参数。

该值必须是真实 URL,格式 https://server_name为 或 GUID,格式为 1234-5678-9807。

参数属性

类型:SPWebPipeBind
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:True
来自管道的值(按属性名称):False
来自剩余参数的值:False

-WhatIf

适用:SharePoint Server 2010、SharePoint Server 2013、SharePoint Server 2016 SharePoint Server 2019

显示一条描述命令作用的消息,而不执行命令。 有关详细信息,请键入以下命令:get-help about_commonparameters

参数属性

类型:SwitchParameter
默认值:None
支持通配符:False
不显示:False
别名:无线

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

CommonParameters

此 cmdlet 支持通用参数:-Debug、-ErrorAction、-ErrorVariable、-InformationAction、-InformationVariable、-OutBuffer、-OutVariable、-PipelineVariable、-ProgressAction、-Verbose、-WarningAction 和 -WarningVariable。 有关详细信息,请参阅 about_CommonParameters