Thursday, December 5, 2024
HomeMicrosoft 365PowerShellHow to delete legacy users from SharePoint Online sites using PowerShell

How to delete legacy users from SharePoint Online sites using PowerShell

The preceding steps removed access to Microsoft 365 and SharePoint Online. However, the user or guest still appears in people searches and in the SharePoint Online Management Shell when you use the Get-SPOUser cmdlet. To completely remove people from SharePoint, you must remove them from the UserInfo list.

Using the SharePoint Online Management Shell

Download the latest SharePoint Online Management Shell.

Connect to SharePoint Online as a global admin or SharePoint admin in Microsoft 365. To learn how, see Getting started with SharePoint Online Management Shell.

Run the following command:

Remove-SPOUser -Site https://test.sharepoint.com -LoginName jondoe_test.com#EXT#@test.onmicrosoft.com

You can also try to Delete Orphan Users

Most Popular