SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to rename SPPrincipals that are ADGroups.

I've tried with

$SPFarm = Get-SPFarm   
#$SPFarm.MigrateGroup("loginName", "newLoginName")
$SPFarm.MigrateUserAccount("loginName", "newLoginName", $false)

but no success. ("The user does not exist or is not unique.")

I know that is a ReadOnly field, however there is any way to do it via PS?

share|improve this question
MigrateGroup should be able to handle this. What error are you getting? – Steve Lineberry Feb 7 '13 at 16:46
"The user does not exist or is not unique" With a login name that exists, and is an SPWeb.EnsureUser(LoginName) valid. – fallout Feb 8 '13 at 7:56
Are you using claims? If not, are you using the full pre-windows2000 name? domain\groupname – Steve Lineberry Feb 8 '13 at 12:40

Have you tried running the old STSADM way of migrating users - like the following script.

STSADM –o migrateuser –oldlogin MYDOMAIN\old –newlogin MYDOMAIN\new –ignoresidhistory

There might be orphaned users which doesn't get handled correct. You can clean up these orphans using the following script:

# Clean up accounts that is not imported correctly
# Ref:

$upsa = Get-SPServiceApplication | Where-Object {$_.TypeName -like "User Profile Service Application"}

# List all user accounts that is not imported correctly
Set-SPProfileServiceApplication $upsa -GetNonImportedObjects $true

# Remove user accounts not imported correctly 
# Uncomment line below to run
Set-SPProfileServiceApplication $upsa -PurgeNonImportedObjects $true

# Run a full User Profile Service Syncronisation, and make sure users end up in Profile database.
# If not, users who log in will create new NonImportedObject accounts

When this is done you need to run a full syncronization of you User Profile Service Application. These steps worked for me when the Active Directory changed and we needed to map users and groups of the new AD with the old AD.

share|improve this answer

I'm not familiar with this particular function, but elsewhere I know AD groups are treated as SPUsers, so perhaps you need MigrateUserAccount instead?

share|improve this answer
I've try both, and both return that 'user does not exist..' message. But thanks for the advice. – fallout Feb 8 '13 at 8:02

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.