?
Solved

Script to Manage AD Security Groups

Posted on 2011-09-30
2
Medium Priority
?
419 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 27

Accepted Solution

by:
KenMcF earned 2000 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

Featured Post

Office 365 Training for Admins - 7 Day Trial

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Uncontrolled local administrators groups within any organization pose a huge security risk. Because these groups are locally managed it becomes difficult to audit and maintain them.
Group policies can be applied selectively to specific devices with the help of groups. Utilising this, it is possible to phase-in group policies, over a period of time, by randomly adding non-members user or computers at a set interval, to a group f…
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…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Suggested Courses

770 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