I'm facing an issue while moving a user.
I'm first retrieving the user object:
$Site = Get-SPSite "https://mysite.mydomain.com"
$Web = $Site.OpenWeb()
$User = $Web.EnsureUser("domain\userid")
And then I'm executing the below to migrate the user:
Move-SPUser -Identity $User -newalias "domain\userid" -IgnoreSID
But when I do so, I get an error:
Move-SPUser : The given key was not present in the dictionary. At line:21 char:1 + Move-SPUser -Identity $User -newalias "domain\userid" -IgnoreSID + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidData: (Microsoft.Share...PCmdletMoveUser: SPCmdletMoveUser) [Move-SPUser], KeyNotFoundException + FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletMoveUser