I am going to migrate users with Move-SPUser. To do this, I am getting the user first:
$user = Get-SPUser -Identity $adAccount -web https://sharepoint/site-collection
The moving them:
Move-SPUser –Identity $user –NewAlias $NewAccountName -IgnoreSID -Confirm:$false
It appears when I get a user, I have to point to a specific site collection; whereas the actual move cmd doesn't reference any site collection. The problem I am having is we have 22 site collections and I would rather not have to traverse all the site collections to find the user first to fill the $user variable. I tried using:
Move-SPUser –Identity "domain\user-account" –NewAlias $NewAccountName -IgnoreSID -Confirm:$false
but it caused an error:
Get-SPUser : You must specify a valid user object or user identity.
I guess if I have to go through each site collection first I will, but I have 7,000 users to migrate and it seems really inefficient to have to do that.
Also, if that is the only way the user information list in the site collection gets updated (because the $user object somehow holds a reference to the site collection) that would make it necessary for me to do it because the user might exist in more than one site collection.
Hope that makes sense and any advice is appreciated.