Is there any way via GUI or PowerShell to remove the disabled user account from M365 groups, Distributions lists and Security groups when users account is disabled in tenant?

Vinod Survase 4,726 Reputation points
2024-01-25T09:50:04.8933333+00:00

Is there any way via GUI or PowerShell to remove the disabled user account from M365 groups, Distributions lists and Security groups when users account is disabled in tenant? I know there is way from Dynamic user and security group but I was looking from M365 and other type of groups which I mentioned above except Dynamic groups.

Microsoft 365
Microsoft 365
Formerly Office 365, is a line of subscription services offered by Microsoft which adds to and includes the Microsoft Office product line.
4,368 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Vasil Michev 100.2K Reputation points MVP
    2024-01-25T16:58:02.9333333+00:00

    There are plenty of script samples out there that do this, here's one of mine: https://www.michev.info/blog/post/4409/remove-user-from-all-microsoft-365-groups-updated-2023-version-of-the-script It works for both Exchange (Distribution) and Entra ID (security or M365) groups, expect dynamic ones.