PowerTip: Use PowerShell to remove a user from all site collections in SharePoint Online


Summary: Learn how to use PowerShell to remove a corporate user from all site collections in SharePoint Online.

Hey, Scripting Guy! Question How can I use Windows PowerShell to quickly remove a corporate user from all site collections in SharePoint Online?

Hey, Scripting Guy! Answer Use the following commands (change the login user name as required):

Get-SPOSite | ForEach-object{Remove-SPOUser -Site $_.Url -LoginName kmyer@contoso.com}

The Doctor

Comments (1)

  1. Chen V says:

    Get-SPOSite will retrieve 200 sites by default. To retrieve all use Get-SPOSite -All if in case your environment has more than 200 site collections.

Skip to main content