0

I have set of Sids provided by client to delete the respective users from site permanently using share point 2013 power shell.

Firstly, I tried below script to get user by sid as below, but it does not provide user details for some Sids (These sids has to be deleted by me anyway from the site)

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue #Variables $SiteURL="https://intranet.crescent.com" $UserSID = "S-1-5-21-3173304932-3636910964-1439844995-11231" #Get the User by SID Get-SPUser -Web $SiteURL -limit All | where {$_.Sid -eq $UserSID} | Select UserLogin, DisplayName

Kindly help me in achieving the same.

Thanks

1 Answer 1

0

If you delete and recreate a user account, SID changes. If user use Move-SPUser to create new mappings for SID and user profile, it may also brings you similar situation.

I will suggest you to first use PowerShell or Rest API to get the correct SID of the account you want to remove

Rest Api endpoint for SharePoint 2013:

http://siteurl/_api/SP.UserProfiles.PeopleManager/GetUserProfilePropertyFor(accountName=@v,propertyName='LastName')?@v='domain\username'

Reference:https://www.vrdmn.com/2013/07/sharepoint-2013-get-userprofile.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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