Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

need assistance with a quest AD cmdlets script

Posted on 2013-10-29
2
Medium Priority
?
324 Views
Last Modified: 2013-10-29
can someone provide a script that will accomplish the following:

1. search a top level OU [and OU's under it]
2. look for a value in CustomAttribute1 - not equal to contractors
3. add the user to a group [VAusers] if customattribute1 not equal to "contractors"

many thanks.

S.
0
Comment
Question by:siber1
2 Comments
 
LVL 40

Accepted Solution

by:
Subsun earned 2000 total points
ID: 39610515
Try..
script will search for users under OU "OU=Users,OU=HQ,DC=Domain,DC=com"
Get-QADuser -sizelimit 0 -searchroot "OU=Users,OU=HQ,DC=Domain,DC=com" -ip "extensionattribute1" |
?{$_.extensionattribute1 -ne "contractors"} | Add-QADGroupMember VAusers

Open in new window

0
 

Author Closing Comment

by:siber1
ID: 39610537
perfect. thanks Subsun
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

As much as Microsoft wants to kill off PST file support, just as they tried to do with public folders, there are still times when it is useful or downright necessary to export Exchange mailboxes to PST files. Thankfully, it is still possible to e…
Exchange administrators are always vigilant about Exchange crashes and disasters that are possible any time. It is quite essential to identify the symptoms of a possible Exchange issue and be prepared with a proper recovery plan. There are multiple…
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…
Suggested Courses

810 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