none
Microsoft Powershell RRS feed

  • Question

  • I would like to know how to Powershell moving bulk user accounts in an OU to different OU without needing a list of the users in the OU.  I also want to move them based on their department attribute.  

    Thanks for your assistance.

    Example: Move users to different OU based on their department.

    • Moved by Bill_Stewart Friday, July 27, 2018 6:35 PM Unanswerable drive-by question
    Wednesday, May 2, 2018 4:39 PM

All replies

  • I would use the Get-ADUser cmdlet and use the -SearchBase parameter to specify the DN of the OU. And I would run the cmdlet once for each department, using the -filter parameter to retrieve users in the OU where the department attribute matches what you specify. Then pipe to the Move-ADObject cmdlet, where you specify the DN of the target OU. Check the helps for the cmdlets.

    Richard Mueller - MVP Enterprise Mobility (Identity and Access)

    Wednesday, May 2, 2018 5:34 PM