none
Auto redirection Computers (to another OU)

    Question

  • Hi,

    I would like to ask, whether AD giving simple way to redirect (from standard OU - Computers) new adding computers  to another OU (filtering by name).

    How its now and how i see it:

    now when new PC is added to AD he's going to "Computers" OU

    i give unique name for group of computers - like:

    xxyy (where xx is number for town and yy it is unique number for PC on this location).

    I want set auto filtering - where new PC added to AD, he be relocation to special OU for location for town (filtering by xx)

    It's possible without special programs ?

    Thursday, January 19, 2017 12:25 PM

All replies

  • Hi,

    You can use the follwings powershell command to join new computer to domain on corresponding OU:

    Add-Computer -DomainName "DomainName" -OUPath "OU=OUNAME,DC=domain,DC=Domain,DC=com"

    To get more info you can refer to this :

    Add-Computer


    Please don't forget to mark the correct answer, to help others who have the same issue. Thameur BOURBITA MCSE | MCSA My Blog : http://bourbitathameur.blogspot.fr/

    Thursday, January 19, 2017 12:36 PM
  • But that will works in moments when PC is added to AD.


    I ask for that, becouse someone (i dont know who) do it like that (for one location):

    when PC is added to AD by "My Computers"; (i think) PC jump to OC Computers and in next step to xx OC.


    Now I do not do special things and PC is passed to good location... i dont have any idea how it works.


    Thursday, January 19, 2017 1:18 PM
  • Hi,

    Below a command , you can use it to create a powershel script and run it through schedule task .you should update the town number (xxx,yyy,zzz) with the correct value , these commands  will check if there is a computer object in the Computers OU  , check the number town based on computer name, ithen it moves them to right OU:

    Get-ADComputer -SearchBase "OU=computer,DC=domain,DC=com" -Filter {samaccountname -like "*xxx*$"} | ForEach-Object{Move-ADObject  -TargetPath 'CN=xxx,DC=domain,DC=com'}
    
    Get-ADComputer -SearchBase "OU=computer,DC=domain,DC=com" -Filter {samaccountname -like "*yyy*$"} | ForEach-Object{Move-ADObject  -TargetPath 'CN=yyy,DC=domain,DC=com'}
    
    Get-ADComputer -SearchBase "OU=computer,DC=domain,DC=com" -Filter {samaccountname -like "*zzz*$"} | ForEach-Object{Move-ADObject  -TargetPath 'CN=zzz,DC=domain,DC=com'}


    Please don't forget to mark the correct answer, to help others who have the same issue. Thameur BOURBITA MCSE | MCSA My Blog : http://bourbitathameur.blogspot.fr/


    Thursday, January 19, 2017 4:46 PM
  • Have a look at this: http://www.adaxes.com/tutorials_AutomatingDailyTasks_MoveNewUsersToOU.htm

    It allows you to move newly created users as part of provisioning procedures using condition-based rules. 

    Friday, January 20, 2017 6:16 AM
  • Hi,

    I am checking how the issue going, if you still have any questions, please feel free to contact us.

    And if the replies as above are helpful, we would appreciate you to mark them as answers, and if you resolve it using your own solution, please share your experience and solution here. It will be greatly helpful to others who have the same question.

    Appreciate for your feedback.

    Best regards,

    Wendy


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    Monday, January 23, 2017 9:52 AM
    Moderator