0

I am new to SharePoint, I have gone through the article of Microsoft for removing the user from SharePoint (Remove license, delete user from O365 users).

Delete a user from your organization https://docs.microsoft.com/en-us/sharepoint/remove-users

I want to know what if the user who left the organization was added into 50 different Sharepoint groups of different sites.

what should be the process to remove such user from all groups from all site (also share if any precaution needs to be taken before doing that)

I just want to define one process to deal with such scenario.

Looking forward for your help

1 Answer 1

1

You can use PowerShell command to remove users from all SharePoint groups:

$users=("[email protected]", "user2 @mycompany.com")
$site=https://MyCompany.Sharepoint.com/sites/site1
$groups=Get-SPOSiteGroup -Site $site
foreach($user in $users) { foreach ($group in $groups){Remove-SPOUser -Site $site -LoginName $user -Group $group.LoginName}}

You can change the $site parameter with your sites. More information: SharePoint Online: Remove users from site groups using PowerShell

Your Answer

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

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