Hi @Srabon ,
You could try to use the following PowerShell script to remove user.
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
Function Delete-UserFromAllSites([string]$WebAppURL, [string]$UserID)
{
#Get All Site collections
$SitesColl = Get-SPWebApplication $WebAppURL | Get-SPSite -Limit All
foreach($Site in $SitesColl)
{
write-host "Processing site:" $Site.RootWeb.URL
#Check if user Exists in the site collection
$User = $Site.RootWeb.SiteUsers | Where-Object {$_.LoginName -eq $UserID}
#If user account found
if($User -ne $null)
{
#Remove User from the Site
Remove-SPUser $UserID -web $Site.RootWeb.URL -confirm:$false
write-host "Removed user from site collection:"$Site.RootWeb.URL -f Green
}
}
}
#Variables for processing
$WebAppURL = "https://Portal.Crescent.com/"
$UserID="Crescent\DaveP"
#Call the function
Delete-UserFromAllSites $WebAppURL $UserID
And the UserInfo Table stores descriptive properties and security information about principals with access to a site collection.
For Reference:
UserInfo Table
Remove User from All Sites in SharePoint using PowerShell
Note: Microsoft is providing this information as a convenience to you. The sites are not controlled by Microsoft. Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. Please make sure that you completely understand the risk before retrieving any suggestions from the above link.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.