Set-SPUser
配置现有用户的属性。
语法
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
指定要添加到用户的权限级别。
该值必须是以下选项之一:
--贡献
可以查看、添加、更新和删除列表项和文档。
--设计
可以查看、添加、更新、删除、批准和自定义文档。
--Full Control
对所有文档具有完全控制权。
--受限访问
授予权限后,可以查看特定列表、文档库、列表项、文件夹或文档。
--读
可以查看页面和列表项以及下载文档。
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
管理对象以便正确进行处理。 使用 SPWeb 或 SPSite 等对象可能会耗用大量内存,而且在 Windows PowerShell 脚本中使用这些对象需要正确管理内存。 通过使用 SPAssignment 对象,可以将对象分配给变量,然后在不需要这些对象时对它们进行处理,以释放内存。 在使用 SPWeb、SPSite 或 SPSiteAdministration 对象时,如果不使用分配集合或 Global 参数,则会自动处理这些对象。
使用全局参数时,所有对象均包含在全局存储中。
如果未立即使用对象,或未通过使用 Stop-SPAssignment
命令来处理对象,则可能会发生内存不足的情况。
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
从用户中删除所有分配的权限。 如果存在“清除”和“添加”值,则首先清除权限,然后添加新权限。
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
执行命令前,看到确认提示。
有关详细信息,请键入以下命令: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
指定用户的新显示名称。
类型必须是有效的名称。
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 |
指定用户的新电子邮件地址。
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
将用户添加到给定站点中的现有组。
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
指定要返回的用户的 GUID、登录名或 SPUser 对象。
该类型必须是表单 1234-5678-9876-0987 中的现有用户的 GUID。
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
指定是否将用户设置为网站集管理员。
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
如果未提供,则指示此 cmdlet 没有输出。 如果提供,此参数指示要返回此用户的 SPUser 对象。
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
从用户中删除权限级别。
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
如果已提供,则指定将从用户目录存储同步用户信息。 此开关仅从目录存储中检索 displayName
和 mail
值。 它支持 Active Directory (经典或Windows 身份验证) 、基于表单的身份验证和 SAML。 FBA 和 SAML 提供程序必须支持从其目录存储进行解析,才能使此开关正常工作。 开关仅支持 SharePoint User 对象。
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
指定要用作范围的 URL 或 GUID 的名称。 如果将 SPUser 对象作为标识提供,则不需要此参数。
该值必须是真实 URL,格式 https://server_name为 或 GUID,格式为 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
显示一条描述命令作用的消息,而不执行命令。
有关详细信息,请键入以下命令: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 |