Link to home
Start Free TrialLog in
Avatar of mystikal1000
mystikal1000

asked on

Creating multiple Domain Local groups in specific OU.

Does anyone have a script to create multiple Domain Local groups in AD by reading a txt file?  I need to create over 100 Domain Local groups and I rather do it using a script.  I need it under a specific OU because of security rights.

I will reward points asap.
Avatar of Sarang Tinguria
Sarang Tinguria
Flag of India image

Avatar of mystikal1000
mystikal1000

ASKER

I rather not use this powerscript, but I received an error in the code, cause we have a large AD.  Does anyone have a VBScript instead?


The string starting:
At c:\powershell script\bulk_ad_group_creation.ps1:37 char:30
+     Write-Host "Target OU can <<<< 't be found! Group creation skipped!"
is missing the terminator: '.
At c:\powershell script\bulk_ad_group_creation.ps1:39 char:2
+ } <<<<
    + CategoryInfo          : ParserError: (t be found! Gro...ipped!"
  }
}:String) [], ParseException
    + FullyQualifiedErrorId : TerminatorExpectedAtEndOfString

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of RobSampson
RobSampson
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Rob gave you great solution and I would use it in your case. However, if you are interested in something simple using DSADD command with for loop, please let me know. I will give you a script for that

But as I said, Rob gave you complete solution and if you only want to create groups, follow his script

Regards,
Krzysztof
Rob I really don't need to add users, however I left it blank.

I am getting an error when trying to test with one group.




Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.

c:\AD_Groups.vbs(26, 1) (null): 0x80005000
An error on line 26 (which is this line)
strOU = "CN=Users," & strDomain

means that the OU cannot be found.  The OU segments are specified backwards when in distinguished name format.

In your AD, say you wanted to put the groups into
domain.com\Offices\Office1\Groups

So for strOU, you would use
strOU = "OU=Groups,OU=Office1,OU=Offices," & strDomain

Try that and see how you go.

Regards,

Rob.