AD.OU.Create
Top  Previous  Next


Creates organizational unit

AD.OU.Create automatically ignores "The object already exists" errors - it works fine to "create" the same OU more than once.

Category
Active Directory

Script section
All

AD.OU.Create
Path, Name [,Force]

Path
Path to container in which to create OU  

Name
Name of OU to create  

Force [Optional parameter]
Options: Force |  
·Force - causes the command to automatically create all missing parent OUs when needed  
·Nothing - blank parameter - halt with an error if a parent OU is missing  

Examples
1) Create OU myOU (domain = d09.acme.com)

Ad.Ou.Create dc=com/dc=acme/dc=D09,myou

2) Create OU OUinmyOU in OU myOU

Ad.Ou.Create dc=com/dc=acme/dc=D09/ou=myOU,OUinmyOU

3) Create OU3 in OU2 in OU1 (none of the OUs exists)

Ad.Ou.Create dc=com/dc=acme/dc=D09/ou=OU1/ou=OU2,OU3,Force

(Without the "Force" switch, the above command would had returned an "There is no such object on the server" error if OU2 or OU1 where not present.)