Quick Fix: SBS & Essentials OU Structure

Logo1Are you new to managing an OS other than Small Business Server?

If so you may be forgiven for thinking that that ‘MyBusiness’ OU Structure present in SBS for as long as i have worked with it, is the norm for an Active Directory domain. Indeed if you go into Group Policy Management and find those OUs missing, you might think… er.. ‘this is broken!’

Fear not. It is very easy to recreate these OUs in seconds. Simply open up an Elevated PowerShell and copy and paste these commands.

Import-Module ActiveDirectory
$domain = (Get-ADDomain)
$DN = $domain.DistinguishedName     
New-ADOrganizationalUnit -name "MyBusiness" -path $DN
New-ADOrganizationalUnit -name "Computers" -path "OU=MyBusiness,$DN"
New-ADOrganizationalUnit -name "Distribution Groups" -path "OU=MyBusiness,$DN"
New-ADOrganizationalUnit -name "Security Groups" -path "OU=MyBusiness,$DN"
New-ADOrganizationalUnit -name "Users" -path "OU=MyBusiness,$DN"
New-ADOrganizationalUnit -name "SBSComputers" -path "OU=Computers,OU=MyBusiness,$DN"
New-ADOrganizationalUnit -name "SBSServers" -path "OU=Computers,OU=MyBusiness,$DN"
New-ADOrganizationalUnit -name "SBSUsers" -path "OU=Users,OU=MyBusiness,$DN"

Essentials OU Structure

You can also change the default location for new users and new computers by following this KB Article.

About Robert Pearman
Robert Pearman is a UK based Small Business Server enthusiast. He has been working within the SMB IT Industry for what feels like forever. Robert likes Piña colada and taking walks in the rain, on occasion he also enjoys writing about Small Business Technology like Windows Server Essentials or more recently writing PowerShell Scripts. If you're in trouble, and you can find him, maybe you can ask him a question.

13 Responses to Quick Fix: SBS & Essentials OU Structure

  1. Robin says:

    Thanks Robert, that really helps, especially the KB article, I didn’t know about that!

  2. First of all, thanks for the script, its really usefull.
    Now im in a project to migrate a full structure of an AD to another server.
    What can I do to use the same structure as you used or similar but with the CSV exported file?

    Thank You.

    • Do you have an example of your CSV exported structure?

      • At the moment we have separeted csv files (OrganizationalUnit, Users, Groups) of the Server A
        Here is the OrganizationalUnit csv file:
        #TYPE Selected.Microsoft.ActiveDirectory.Management.ADOrganizationalUnit

        Our plan is to transfer structure of the Server A to a Clean Server B.

  3. Hey, ok this took a bit of time to work on, and I had to clean up the CSV as well as the field names are enclosed in quotes, and the values also have quotes, but not string quotes ” “, more like the 6699 quotes, but that could just be due to the way wordpress displays it.

    $csv = import-csv “C:\users\Robert\Desktop\working\csvcsv.csv”

    foreach ($line in $csv)
    $dn = “,DC=losmaic,DC=com”
    $line = $line.Name
    $line = $line.ToString()

    $line = $line -replace “$dn”,””

    $lineS= $line.Split(“,”)
    $lineS = $lineS -replace (‘“’,””)
    $lineS = $lineS -replace (‘”’,””)
    Write-Output “”
    $count = ($lineS | measure-object).Count
    if (($count) -eq “1”)
    $dn = $dn.SubString(1)
    Write-Output “New-ADOrganizationalUnit $lineS -path $dn”
    if (($count) -eq “2”)
    $ou = $lines[0]
    $path = $lines[1]
    Write-Output “New-ADOrganizationalUnit $ou -path “”$path$dn”””
    if (($count) -eq “3”)
    $ou = $lines[0]
    $path = $lines[1]
    $path2 = $lines[2]
    Write-Output “New-ADOrganizationalUnit $ou -path “”$path,$path2$dn”””

    So, honestly with that number of OUs I would probably consider not using powershell, having said that it produced the following output so it may work.

    New-ADOrganizationalUnit OU=ou93266 -path DC=losmaic,DC=com

    New-ADOrganizationalUnit OU=oupas -path “OU=ou93266,DC=losmaic,DC=com”

    New-ADOrganizationalUnit OU=ougs -path “OU=ou93266,DC=losmaic,DC=com”

    New-ADOrganizationalUnit OU=ouasix1 -path “OU=ougs,OU=ou93266,DC=losmaic,DC=com”

    New-ADOrganizationalUnit OU=ouasix2 -path “OU=ougs,OU=ou93266,DC=losmaic,DC=com”

    New-ADOrganizationalUnit OU=oudaw1 -path “OU=ougs,OU=ou93266,DC=losmaic,DC=com”

    New-ADOrganizationalUnit OU=oudaw2 -path “OU=ougs,OU=ou93266,DC=losmaic,DC=com”

    New-ADOrganizationalUnit OU=ougm -path “OU=ou93266,DC=losmaic,DC=com”

    New-ADOrganizationalUnit OU=ousmx1 -path “OU=ougm,OU=ou93266,DC=losmaic,DC=com”

    • Many many thanks!!! This structure will help me and view it in another PoV I just need to do add some features but its great.

      I’ve been searching at the net for this kind of script, and no results to find out how to migrate a structure of AD with powershell..

      Really appreciate :)

      • Let me know if I can help any more, or if you think another post would be helpful.

        I have some scripts for creating users and groups and populating groups from CSVs.

  4. from above – looks like that is an issue with the way wordpress displays quotes.

  5. dkroger2014 says:

    I migrated SBS 2003 to Windows 2012 R2 Essentials. Can I safely remove the MyBusiness OU after migration is complete? I would like to reduce the user count.

    • You are free to remove whatever you want. But please ensure that if there are users within that OU – you confirm they are no longer needed and that moving any users to a new OU will not have an adverse effect with any GPO settings that may be, or may not be enforced.

Leave a reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: