Move-SPUser

移轉 SharePoint 產品中的使用者帳戶。

Syntax

Move-SPUser
    [-Identity] <SPUserPipeBind>
    -NewAlias <String>
    [-AssignmentCollection <SPAssignmentCollection>]
    [-Confirm]
    [-IgnoreSID]
    [-WhatIf]
    [<CommonParameters>]

Description

The Move-SPUser cmdlet migrates user access from one domain user account to another. If an entry for the new login name already exists, the entry is marked for deletion to make way for the migration.

如需適用於 SharePoint 產品的 Windows PowerShell 權限及最新資訊,請參閱線上文件 SharePoint Server Cmdlet

範例

------------------範例------------------

$user = Get-SPUser -Identity "DOMAIN\JaneDoe" -Web https://webUrl
Move-SPUser -Identity $user -NewAlias "Domain\JaneSmith" -IgnoreSid

此範例會將 DOMAIN\JaneDoe 移轉到 DOMAIN\JaneSmith 的新帳戶。

------------------範例 2------------------

$user = Get-SPUser -Identity "DomainA\JaneDoe" -Web https://webUrl
Move-SPUser -Identity $user -NewAlias "DomainB\JaneDoe"

本範例會在已啟用 SID 歷程記錄的 DomainB 中,將 DOMAIN\JaneDoe 從 DomainA 移轉至 DOMAINB\JaneDoe 的新帳戶。

------------------範例 3------------------

$user = Get-SPUser -Identity "i:0#.w|DOMAIN\JaneDoe" -Web https://webUrl
Move-SPUser -Identity $user -NewAlias "i:0#.w|Domain\JaneSmith" -IgnoreSid

本範例會在使用 Windows 宣告時,將 DOMAIN\JaneDoe 移轉至 DOMAIN\JaneSmith 的新帳戶。 -IgnoreSid 使用宣告身分識別時,必須一律搭配 Move-SPUser 使用,例如 Windows 宣告。

參數

-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
Accept pipeline input:True
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition

-Confirm

在執行命令之前,提示您確認操作。 如需詳細資訊,請輸入下列命令:get-help about_commonparameters

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition

-Identity

指定透過 SPUserGet-SPUser 取的物件。

型別必須是有效的 SPUser 物件。

Type:SPUserPipeBind
Aliases:UserAlias
Position:1
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition

-IgnoreSID

指出 (若存在) 不會向 Active Directory 查詢 SID 歷程記錄屬性,確保新的登入名稱對應至舊的登入名稱。

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition

-NewAlias

指定使用者帳戶的新登入名稱。

此類型必須是有效的登入名稱,格式為 DOMAIN\username。

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition

-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
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition