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

说明

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

有关适用于 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

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

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

--参与

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

--设计

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

--完全控制

可以完全控制所有文档。

--受限访问

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

--Read

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

参数属性

类型:

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 对象。

类型必须是现有用户的 GUID,格式为 1234-5678-9876-0987。

参数属性

类型: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

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

参数属性

类型: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
别名:WI

参数集

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

CommonParameters

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