[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Script to Manage AD Security Groups

Posted on 2011-09-30
2
Medium Priority
?
420 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

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

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.
Active Directory can easily get cluttered with unused service, user and computer accounts. In this article, I will show you the way I like to implement ADCleanup..
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.
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

656 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