create users and pass generation full powershell

Touraj 6 Reputation points
2021-01-06T19:28:11.177+00:00

Hello, in Active Directory, I am looking to create a large number of users with the department, which is not one by one.
I want to know if there is a script that can automatically create an organizational unit so that users of each department can be added directly to the same organizational unit.
I also gave him my random password
thankyou

Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,548 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
22,058 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Andreas Baumgarten 110.9K Reputation points MVP
    2021-01-06T19:40:18.137+00:00

    Maybe these are a good points to start with:

    https://www.rebeladmin.com/2018/01/create-active-directory-user-objects-using-powershell/
    https://www.lepide.com/how-to/managing-ous-with-windows-powershell.html
    https://activedirectoryfaq.com/2017/08/creating-individual-random-passwords/


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

    Regards
    Andreas Baumgarten

    1 person found this answer helpful.
    0 comments No comments

  2. Touraj 6 Reputation points
    2021-01-06T19:49:16.837+00:00

    See I want a script that automatically adds the users it creates to the relevant department (organizational unit) that is defined in Excel

    That is, I give the name and surname of the department in Excel, and this Power Shell script creates an organizational unit based on this department and makes users a member of that organizational unit automatically.

    0 comments No comments

  3. Ian Xue 37,541 Reputation points Microsoft Vendor
    2021-01-07T06:25:27.533+00:00

    Hi,

    To create OUs and AD users you can use the cmdlets New-ADOrganizationalUnit and New-ADUser.

    https://learn.microsoft.com/en-us/powershell/module/activedirectory/new-adorganizationalunit
    https://learn.microsoft.com/en-us/powershell/module/addsadministration/new-aduser

    Best Regards,
    Ian Xue

    ============================================

    If the Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    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.