Move-SPUser common errors
There is something great with ladies: they change their name when get married .There is something SharePoint do not like: when people change their Name…
When user change their AccountName, SharePoint do not “see” it very well. You have to use the Move-SPUser cmdlet (or stsadm –o migrateuser for Moss 2007)
Technet documentation (Here) give this example:
Move-SPUser –Identity “DOMAIN\JaneDoe” –NewAlias “Domain\JaneSmith”
But if you try it, this command fails. Because the identity parameter shall not be a String, but an SPUser object. Instead try this:
$user= Get-SPUser -Identity <LoginName> -Web <A WebSite in your Farm>
Move-SPUser –Identity $user –NewAlias “Domain\newLogin” -IgnoreSID
And if this command fails in a “User unknown” error, you should try to launch it under Identity Account.
To sum-up:
- Log as Identiy Account
- Do a get-SPUser first