Ö
Örjan Johansson
Hi all!
I've been studying a bunch of scripts to aid in creating a rather complex AD
structure, and I've seen several examples of creating both OU's and users.
However, all of them create OU's at the root level, and users in that OU.
For example:
##Script
Set oRoot = GetObject("LDAP://rootDSE")
Set oDomain = GetObject("LDAP://" &
oRoot.Get("defaultNamingContext"))
Set oOU=oDomain.Create("organizationalUnit",
"ou=Demo OU")
oOU.Put "Description", "Demonstration OU"
oOU.SetInfo
Set oGroup = oOU.Create("Group", "cn=Demo
Group")
oGroup.Put "sAMAccountName", "DemoGroup"
oGroup.Put "Description", "Demonstration
Group"
oGroup.SetInfo
Set oUser = oOU.Create("User", "cn=Demo User")
oUser.Put "sAMAccountName", "DemoUser"
oUser.Put "Description", "Demonstration User"
oUser.SetInfo
oUser.SetPassword "qW5rty"
oUser.AccountDisabled = False
oUser.SetInfo
oGroup.Add oUser.ADSPath
#/script
I want to create OU's several levels deep, for instance an OU called
Mycompany at the root level, an OU called Stockholm in that OU, another one
called Gothenbourg in the same OU, an OU called Admin in each of these, an
OU called users in each of these etc etc... (hope I'm not losing you guys).
Can anyone point me to docs or scripts describing creating more complex
structures like this?
Any input extremely appreciated!
TIA,
Örjan
I've been studying a bunch of scripts to aid in creating a rather complex AD
structure, and I've seen several examples of creating both OU's and users.
However, all of them create OU's at the root level, and users in that OU.
For example:
##Script
Set oRoot = GetObject("LDAP://rootDSE")
Set oDomain = GetObject("LDAP://" &
oRoot.Get("defaultNamingContext"))
Set oOU=oDomain.Create("organizationalUnit",
"ou=Demo OU")
oOU.Put "Description", "Demonstration OU"
oOU.SetInfo
Set oGroup = oOU.Create("Group", "cn=Demo
Group")
oGroup.Put "sAMAccountName", "DemoGroup"
oGroup.Put "Description", "Demonstration
Group"
oGroup.SetInfo
Set oUser = oOU.Create("User", "cn=Demo User")
oUser.Put "sAMAccountName", "DemoUser"
oUser.Put "Description", "Demonstration User"
oUser.SetInfo
oUser.SetPassword "qW5rty"
oUser.AccountDisabled = False
oUser.SetInfo
oGroup.Add oUser.ADSPath
#/script
I want to create OU's several levels deep, for instance an OU called
Mycompany at the root level, an OU called Stockholm in that OU, another one
called Gothenbourg in the same OU, an OU called Admin in each of these, an
OU called users in each of these etc etc... (hope I'm not losing you guys).
Can anyone point me to docs or scripts describing creating more complex
structures like this?
Any input extremely appreciated!
TIA,
Örjan