I have some code that will create an Active Directory OU underneedth the parent OU, however I need it to go one level deeper.
My directory structure is setup with the following OUs
Domain OU
Department OU
and then the departments(this is where I need the new OU to be created
Example: domain\department\IT
domain\department\HR
domain\department\Finance
' This code creates an OU
' ------ SCRIPT CONFIGURATION ------
strOrgUnit = "test44" ' e.g. Tools
strOrgUnitParent = "ou=Domain,dc=adts,dc=lan" ' e.g. ou=BioPort,ou=departments,dc=adts,dc=lan
strOrgUnitDescr = "testou" ' e.g. Tools Users
' ------ END CONFIGURATION ---------
set objDomain = GetObject("LDAP://" & strOrgUnitParent)
set objOU = objDomain.Create("organizationalUnit", "OU=" & strOrgUnit)
objOU.Put "description", strOrgUnitDescr
objOU.SetInfo
WScript.Echo "Successfully created " & objOU.Name
My directory structure is setup with the following OUs
Domain OU
Department OU
and then the departments(this is where I need the new OU to be created
Example: domain\department\IT
domain\department\HR
domain\department\Finance
' This code creates an OU
' ------ SCRIPT CONFIGURATION ------
strOrgUnit = "test44" ' e.g. Tools
strOrgUnitParent = "ou=Domain,dc=adts,dc=lan" ' e.g. ou=BioPort,ou=departments,dc=adts,dc=lan
strOrgUnitDescr = "testou" ' e.g. Tools Users
' ------ END CONFIGURATION ---------
set objDomain = GetObject("LDAP://" & strOrgUnitParent)
set objOU = objDomain.Create("organizationalUnit", "OU=" & strOrgUnit)
objOU.Put "description", strOrgUnitDescr
objOU.SetInfo
WScript.Echo "Successfully created " & objOU.Name