How to selectively delete users with a list of email addresses that the users used to register with?

Ian Hutchinson @onmicrosoft 0 Reputation points
2023-03-12T21:11:51.7966667+00:00

We have all of our user in one tenant (200k+).

If one of our companies would like their users deleted, how can this be done?

The bulk delete tool in Microsoft AD B2C only accepts UPNs.

Our customers do not have UPN visibility, then can only provide the email addresses that their users used to register.

How can I accomplish this?

Windows for business | Windows Client for IT Pros | Directory services | Active Directory
Microsoft Security | Microsoft Entra | Microsoft Entra External ID
Microsoft Security | Microsoft Entra | Microsoft Entra ID
{count} votes

1 answer

Sort by: Most helpful
  1. Limitless Technology 44,751 Reputation points
    2023-03-14T09:01:52.39+00:00

    Hello there,

    You can use PowerShell to achieve this.

    The Remove-ADUser cmdlet removes an Active Directory user.

    The Identity parameter specifies the Active Directory user to remove. You can identify a user by its distinguished name (DN), GUID, security identifier (SID), or Security Account Manager (SAM) account name. You can also set the Identity parameter to a user object variable, such as $<localUserObject>, or you can pass a user object through the pipeline to the Identity parameter.

    https://learn.microsoft.com/en-us/powershell/module/activedirectory/remove-aduser?view=windowsserver2022-ps

    Hope this resolves your Query !!

    --If the reply is helpful, please Upvote and Accept it as an answer--

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.