Below is my script (borrowed from the Internet). It produces a report of all the users in each group.
What I need to do is create a 4th column which is the actual group name (from $groups) that the user came from.
Could this be a clever tweak to my script?
With thanks,
Mike
Code:
Import-Module ActiveDirectory
$groups= "GROUP1","GROUP2","GROUP3"
$selectgroups=$groups |Get-Adgroup
$selectgroups |get-adgroupmember -Recursive |Get-ADUser -property sn |Select givenname,sn,userPrincipalName
What I need to do is create a 4th column which is the actual group name (from $groups) that the user came from.
Could this be a clever tweak to my script?
With thanks,
Mike