Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Adding a security group for members when containing the same attributes values as another security groups members

$
0
0

Im looking for a way to add multiple contact card objects in AD to be members of a specific security groups when they contain specific "employee id" attributes values which are extracted from another security group member's "employee id" attribute. This is the first time writing up a question please be nice.

This is what is needed:

PART ONE:

List out the Employee ID attribute value for all members of security group "XYZ"

Search OU "XYZ" where any of the above Employee ID attributes match a same attributefrom an object within this OU and list out their "name"

PART TWO:

Add all the "name's from OU "XYZ  to be a member of security group "Another XYZ"

Thanks!

This is the first portion I have to list out the employee id attributes in the first step in part one above.

Import-Module ActiveDirectory
get-adgroupmember "XYZ" -recursive | % {
$group=$_
get-aduser $_ -Properties Employeeid | select Employeeid }


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>