Forum Discussion

abedinthehouse's avatar
abedinthehouse
Copper Contributor
Mar 29, 2023
Solved

Bulk Disable Azure AD Users

I am looking for a way to disable (not delete) 300 AzureAD users with the "AccountEnabled" field. I was able to find the script below from an older post but I keep getting an error. I'm new here and ...
  • Kevin_Morgan's avatar
    Mar 30, 2023

    abedinthehouse 

     

    The command to disable Azure AD user is:

    Set-AzureADUser -ObjectID "user_upn_or_id" -AccountEnabled $false

     

    You can just change the line as like below one:

    Set-AzureADUser -ObjectID $user.ObjectId -AccountEnabled $false

     

    Refer this post to update bulk Azure AD User attributes:

    https://morgantechspace.com/2022/03/update-bulk-azure-ad-user-attributes-using-powershell.html

     

    If you're interested in updating bulk Office 365 user profile information without using PowerShell, try the Office 365 Manager from Specmasoft. This tool helps you modify bulk M365 users using CSV, update licenses, add bulk members to groups, and more.

     

    https://specmasoft.com/office-365-manager/update-bulk-azure-ad-users-in-microsoft-365-using-a-csv-file

     

Resources