Win 2019 Change Default OU for Users and Computers

Just a quick post today to show you how to change the default OU for both Users and Computers.

Why would you want to do this? This is advantageous to help manage your active directory. For instance, when a new computer is added to the domain, it will automatically get added to the OU you've nominated, rather than the default Computers folder. Therefore, it saves you having to manually move computers to the OU you have setup to house them.

Let's get started...

First open up Active Directory Users and Computers and follow the screenshot below:

This ensures that you have the Advanced Features enabled so we can obtain additional information about our nominated OU.

We'll change the default computer OU first. Right click on the OU you've created for your computers and select Properties. The following screen will be displayed:

Once you're on the Attribute Editor tab, scroll down until you find the value distinguishedName as in the following example:

The distinguishedName value holds the AD string that we're going to need to use in the next step. Double click the value to reveal the entire string so we can copy the value:

Right click and copy the string so we can use it in the next step. Now open up an admin command prompt. At the command line type in or copy and paste the following:

redircmp OU=Computers,OU=Company,DC=office,DC=Company,DC=com,DC=au

In the command line syntax above, replace my example string OU=Computers,OU=Company,DC=office,DC=Company,DC=com,DC=au with the value you copied from your Attribute Editor in the previous step.

That's it, you're all done with the setting the default computer OU for your Active Directory.

We can now do the same for your users. The steps are identical to the above, obviously using your Users OU Attribute Editor String. Then using the following command line syntax to set it:

redirusr OU=Users,OU=Company,DC=office,DC=Company,DC=com,DC=au

In the command line syntax above, replace my user example string OU=Users,OU=Company,DC=office,DC=Company,DC=com,DC=au with the value you copied from your Tribute Editor for the Users Attribute String.

That's it you're all done. Now when you add a new users or computer to your domain they will be automatically added to the correct OU.

If you've found this useful, you may want to sign up to our newsletter where you'll receive notices on when we post new articles and helpful "how tos". Just fill out your details below and we'll do the rest…

2 Responses

  1. Maybe I am having a Monday, but, going into Active Directory Users and Computers, you create a user in the container selected. Even importing users with powershell, you put the OU into the CSV file. How does the user redirect work? When would the redirect take precedent in user creation?
    • Matrix7
      Hi Bobby, This forces Windows to place any automated User Creation in the OU of your choosing. For instance, if you're setting up AD Connect on your domain to replicate your users etc to O365, the standard users AD Connect creates will be placed in your preferred OU rather than the default Active Directory Users folder. The same will apply to any application that auto creates users as part of it's implementation procedure. Hope that makes sense.... Matrix 7 Team...

Leave a comment

Sign up to our newsletter where you’ll receive notices on when we post new articles and helpful “how tos” to make your IT life easier.