Question

I am using the following script to update the user SID.

$user = Get-SPUser -web http://website.url -Identity DomainA\UserA

Move-SPUser -IgnoreSID -Identity $user -NewAlias 'DomainB\UserA'

However, I am getting the following error:

Move-SPUser : Object reference not set to an instance of an object.
At C:\Scripts\Untitled2.ps1:5 char:1
+ Move-SPUser -Identity $user -NewAlias $claimsAcc -IgnoreSID
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (Microsoft.Share...PCmdletMoveUser:SPCmdletMoveUser) [Move-SPUser], NullRefe 
   renceException
    + FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletMoveUser

User that I am logged in and running powershell script has access in the administrators and permissions list in User Profile service.

Any help?

Was it helpful?

Solution

Couple of things to make sure:

  • Try to the pwoershell under the account which is running SharePoint timer service and Central admin app pool. Actual Farm admin account
  • Permission on UPA.
  • Run powershell console as Run As administrator.

If you are still getting the error then check the ULS logs for the clue.

OTHER TIPS

Make sure you have set up User Profile Service Application on this farm .

The error you encountered may be caused by the account you used haven't enough permission in User Profile Service Application. You need to highlight it, click on permissions on the top bar, add your account (running PowerShell) with Full Control. Then go in “Administrators” and add your account there as well.

You can also try Stsadm command :

stsadm.exe -o migrateuser -oldlogin “domain\user” -newlogin “domain\testuser” -ignoresidhistory

If still cannot resolve the issue , you need collect SharePoint ULS log for further analysis .

Go to Manage service applications. Highlight your User Profile Service Application. In the ribbon, under Sharing, click on the Permissions button and add yourself with Full Control. You should at least see the Farm Administrator account in here as well.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top