learn to find or delete orphaned users from SharePoint Site using Power Shell Script.

Power Shell Script to find and delete orphaned users from the site

learn to find or delete orphaned users from SharePoint Site using Power Shell Script.

First, let’s know Who are orphaned users?

Orphaned users are those who are disabled/removed from the Active Directory.but still have permission in SharePoint site, lists and items. SharePoint keeps “user info” table of the content database for metadata such as created/modified by field.

It’s a best practice to keep farm clean and organized also this will solve the problem active directory users still appearing on the people picker

If we want to delete few users only then browse to the following URL of your site delete a user from there.

http://server:2000/_layouts/people.aspx?MembershipGroupId=0

from this we can get a master list of user from site collection.if you remove the user.user will be removed from the complete site collection

We can also query the users alternatively from SQL server

Step 1: Open SQL Server Management Studio

SELECT * FROM [MOSS_Content_DatabaseName].[dbo].[UserInfo] WHERE tp_Login=’DOMAIN\UserID’

Step 2: Take note of the tp_ID column value

Step 3: Go to HTTP://<your SharePoint-site-collection/_layouts/userdisp.aspx?ID=tp_ID, where tp_ID is the number you found from the above select statement.

Step 4: This will take you to the user’s profile where you can click on the Delete User from Site Collection button.

However, it is very difficult to remove user one by one from the site collection. alternatively, we can adopt PowerShell script to find delete the orphaned users from the site.

 learn to find or delete orphaned users from SharePoint Site using Power Shell Script.
learn to find or delete orphaned users from SharePoint Site using Power Shell Script.