Disabling Multiple AD Users

Abdulrahman 101 Reputation points

Greetings Microsoft Family,

Is there any way to disable Multiple AD Users located in different OUs using PowerShell?

Thank you.

Windows Server
Windows Server
A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.
12,287 questions
Active Directory
Active Directory
A set of directory-based technologies included in Windows Server.
5,996 questions
0 comments No comments
{count} votes

Accepted answer
  1. Andreas Baumgarten 98,626 Reputation points MVP

    Hi @Abdulrahman ,

    yes. But without any details of the users it's hard to help with details.

    There are different options to identify the affected users:

    • If you have a list of the user-names in a file
    • If you have a criteria of the users (for instance same department name)
    • If all users are members of the same AD group

    Basically you need this cmdlet:
    Disable-ADAccount (https://learn.microsoft.com/en-us/powershell/module/activedirectory/disable-adaccount?view=windowsserver2022-ps)


    (If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

    Andreas Baumgarten

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Scott Dawson 156 Reputation points

    As already mentioned, this would work in powershell and it helps to reduce accidents if you specify the entire DN.

    Disable-ADAccount -Identity "CN=Patti Fuller,OU=Finance,OU=UserAccounts,DC=FABRIKAM,DC=COM"
    Disable-ADAccount -Identity "CN=Jack Adams,OU=Finance,OU=UserAccounts,DC=FABRIKAM,DC=COM"
    Disable-ADAccount -Identity "CN=Patti Adams,OU=HR,OU=UserAccounts,DC=FABRIKAM,DC=COM"

    0 comments No comments