The Active Directory attribute userPrincipalName
and related to this samAccountName
have to be changed. As the users are active users in SharePoint the Move-SPUser
command has to be used.
- old samaccountname: DOMAIN\vn
- old userprincipalname: [email protected]
- new samaccountname: DOMAIN\v.name
- new userprincipalname: [email protected]
So the way to tell SharePoint about the new login is:
- user must log off
- UPN/SAN in Active Directory changed
- Move-SPUser command on APP Server Management Shell
- User Profile Sync - Full Sync in Central Administration
- Wait a long time (few hours)
- user logging in again
Code for step 3:
$web = Get-SPWeb "https://sharepoint.site.the.user.visited.before"
$user = Get-SPUser "i:0#.w|DOMAIN\vn" –Web $web
Move-SPUser –Identity $user –NewAlias "i:0#.w|DOMAIN\v.name" –IgnoreSID
Summary: Everything works fine in SharePoint - but there is one major problem with this procedure: All Newsfeed posts of this user made in the past disappeared. They can still be found in Enterprise Search. If clicked there is an "something wrong" error. If visiting a site with Site Feed on it where the user answered in the past, the main post is still there as well as all other replies, but the replies of this user are not shown any more. His old posts seem to be lost!