I am currently using a script to create a large number of OUs inside of a domain. Then the script creates 3 new domain global groups inside each OU. Can anyone tell me what I need to add to this script in order to make these Domain Global Groups members of a domain local group in the Users folder under the domain.
An example of one of my OUs would be the OU name NOVA. NOVA would have three groups a NOVAMaintManagers group which needs to be a member of the domain local group MaintManagers in the domain. A NOVAPower Users group which needs to be a memeber of Power Users. A NOVAUsers group which needs to be a member of Users.
Here is a copy of my current code:
Dim oFSO, oTS, oADRoot, oADDomain, oADOU, oADGroup, szLine, a_szSuffixes, szSuffix
Set oFSO = CreateObject("Scripting.Fi
leSystemOb
ject")
Set oTS = oFSO.OpenTextFile("c:\Scri
ptOU\test.
txt", 1)
Set oADRoot = GetObject("LDAP://rootDSE"
)
Set oADDomain = GetObject("LDAP://" & oADRoot.Get("defaultNaming
Context"))
a_szSuffixes = Array("Users", "MaintManagers", "PowerUsers")
Do Until oTS.AtEndOfStream
szLine = Trim(oTS.ReadLine)
Set oADOU = oADDomain.Create("organiza
tionalUnit
","ou="& szLine)
oADOU.Put "Description", szLine
oADOU.SetInfo
For Each szSuffix In a_szSuffixes
Set oADGroup = oADOU.Create("Group", "cn=" & szLine & szSuffix)
oADGroup.Put "sAMAccountName", szLine & szSuffix & "_AM"
oADGroup.Put "Description", szLine & szSuffix
oADGroup.SetInfo
Next
Loop
oTS.Close
Set oFSO = Nothing
Set oTS = Nothing
Set oADGroup = Nothing
Set oADOU = Nothing
Set oADRoot = Nothing
Set oADDomain = Nothing
Start Free Trial