Solved

Script to Manage AD Security Groups

Posted on 2011-09-30
2
418 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 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

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

A company’s centralized system that manages user data, security, and distributed resources is often a focus of criminal attention. Active Directory (AD) is no exception. In truth, it’s even more likely to be targeted due to the number of companies …
Had a business requirement to store the mobile number in an environmental variable. This is just a quick article on how this was done.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

696 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