Solved

Script to Manage AD Security Groups

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

Free Webinar: AWS Backup & DR

Join our upcoming webinar with experts from AWS, CloudBerry Lab, and the Town of Edgartown IT to discuss best practices for simplifying online backup management and cutting costs.

Question has a verified solution.

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

With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
Active Directory security has been a hot topic of late, and for good reason. With 90% of the world’s organization using this system to manage access to all parts of their IT infrastructure, knowing how to protect against threats and keep vulnerabil…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

749 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