Creating Organizational Units

Creates an Organizational Unit in the current or in the specified context.


Examples:


Hint: The execution of these examples requires a connected PowerShell drive.


Create the Organizational Unit "Frankfurt" in the context "Managed Users & Computers\solys.local":


New-EmdbOrganizationalUnit "emdb:\rootDSE\Managed Users & Computers\solys.local\Frankfurt"


Create the Organizational Unit "Barcelona" in the current context:


Cd "emdb:\rootDSE\Managed Users & Computers\solys.local"

New-EmdbOrganizationalUnit "Barcelona"


Create the Organizational Unit "Lisbon" in the context "Managed Users & Computers\solys.local" using the cmdlet New-Item:


New-Item -Path "emdb:\rootDSE\Managed Users & Computers\solys.local" -Name "Lisbon" -ItemType "OU"


Create the Organizational Unit "Madrid" in the current context using the cmdlet New-Item:


Cd "emdb:\rootDSE\Managed Users & Computers\solys.local"

New-Item "Madrid" -ItemType "OU"


Hint: You can create Organizational Units with the alias Mkdir, too, if the current context is a Domain or an Organizational Unit.


Hint:  In the context of the emdb drive, the cmdlet New-Item provides the additional parameter -DelayCreation. Using this parameter creates the object on the client side only and doesn't propagate the changes to the DSMDB instantly. Now you can manipulate properties of this object and finally the changes can be propagated to the DSMDB by calling the method Create().


Example:


Cd "emdb:\rootDSE\Managed Users & Computers\solys.local"

$MyNewOU = New-Item "Bukarest" -ItemType "OU" -DelayCreation

$MyNewOU.Description = "The new Bukarest organizational unit"

$MyNewOU.Create()