Solved

Script to Manage AD Security Groups

Posted on 2011-09-30
2
413 Views
Last Modified: 2012-06-27
We have an OU named software distribution. In that OU, we create security groups named APP_SOFTWARENAME. In each site OU, we have a subOU named SITENAME Applications. This OU has security groups named SITECODe_APP_SOFTWARENAME

EX:

In the software distribution OU, we have a group named APP_Adobe Reader. Under the London OU, we have a London Applications sub OU. In that OU, we have a security group named LON_APP_Adobe Reader

Can someone provide a script that when ran, will automatically create all of the site security groups?
0
Comment
Question by:Joseph Moody
2 Comments
 
LVL 27

Accepted Solution

by:
KenMcF earned 500 total points
ID: 36896105
You can use powershell with the quest AD CMDLETS. Test this first, I think I understand what you are asking for.


Foreach ($Group in (get-qadgroup -SearchRoot "OU=APP_Groups,DC=DEVLAB,DC=LOCAL" -searchscope OneLevel)){
    Foreach ($OU in (Get-QADObject -type OrganizationalUnit -SearchRoot "OU=APP_Groups,DC=DEVLAB,DC=LOCAL" -searchscope OneLevel)){
        New-QADgroup  -Name "$($OU.Name)_$($Group.Name)" -ParentContainer $OU.DN -grouptype Security
    }
}

Open in new window

0
 
LVL 22

Author Comment

by:Joseph Moody
ID: 37065127
I don't think it did anything. I attached the modified code. What did I do wrong?

The software distribution OU is where all of the top level groups are. The lower level (to be nested groups) for the test OU is the TRANs Application OU.
Foreach ($Group in (get-qadgroup -SearchRoot "OU=Software Distribution,DC=GCBE,DC=LOCAL" -searchscope OneLevel)){    

Foreach ($OU in (Get-QADObject -type OrganizationalUnit -SearchRoot "OU=TRANS Application,OU=Transportation,OU=Administration,OU=Domain Sites,DC=GCBE,DC=LOCAL" -searchscope OneLevel)){        

New-QADgroup  -Name "$($OU.Name)_$($Group.Name)" -ParentContainer $OU.DN -grouptype Security    }}

Open in new window

0

Join & Write a Comment

"Migrate" an SMTP relay receive connector to a new server using info from an old server.
Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles from a Windows Server 2008 domain controller to a Windows Server 2012 domain controlle…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now