Disabling Multiple AD Users

Abdulrahman 101 Reputation points
2022-09-25T10:41:10.12+00:00

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,108 questions
Active Directory
Active Directory
A set of directory-based technologies included in Windows Server.
5,838 questions
0 comments No comments
{count} votes

Accepted answer
  1. Andreas Baumgarten 96,036 Reputation points MVP
    2022-09-25T12:12:58.27+00:00

    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)

    Regards
    Andreas Baumgarten

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Scott Dawson 156 Reputation points
    2022-09-29T09:57:20.497+00:00

    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