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
Your feedback is always appreciated. I will try to reply to your queries as soon as possible- Amol Ghuge
Note: Only a member of this blog may post a comment.