By considering this requirement, we need to remove this specific users across all site collections, all groups, all web applications…
Here is the script for the same:
$URL="https://Sharepoint2010SiteURL"
$site =Get-SPSite($URL)
$web = $site.OpenWeb()
$groups = $web.sitegroups
$user = $web .AllUsers.Item("name of user")
foreach ($spgroup in $groups)
{
$spgroup.RemoveUser($user)
$spgroup.Updae()
}
If you have any queries/questions regarding the above mentioned information then please let me know, Thank you.
No comments:
Post a Comment