I was trying to use the Remove-SPUser cmdlet and kept getting this error:
Remove-SPUser : You must specify a valid user object or user identity.
With claims based authentication the cmdlet Get-SPUser returns all users like this:
So, you can see the format of the –Identity (UserLogin) is something like this:
i:0#.w|DOMAIN\USERID
This thread referred to the Get-SPUser cmdlet and using New-SPClaimsPrincipal, but what I found was pretty simple.
Use this format for the cmdlet:
Remove-SPUser -identity "i:0#.w|cfgmgt\rwright" -web http://cmsp2013:5555
The trick for me was to put double quotes around the encoded user name.
Now, if the Microsoft documentation would be more accurate…
Any idea why database table WSS_Content_.dbo.AllUserData still returns the user I deleted?