This is my first post hear and I am still quite new at PS.
I have created an Active Directory auditing script that loops through all user objects and analyzes them for compliance.
All users have belong to one group that has the prefix ABCD. This denotes their department and establishes access to many systems.
In the main loop there is the Variable $Aduser. This is the current user object being scanned.
I have googled and tinkered quite a bit but with no success.
My basic question is how to I get to here: $ABCD-Group = ?????????
Thanks a lot!
Hmmmm .... most of the time we are not that good with guessing. 😉 You should show the code or the code snipet you already have and the problem with it. You should format it as code please and provide error messages if you get some (Ideally formatted as code as well). 😉
Get-ADuser -Identity 'SamAccountName' -Properties MemberOf
Ditto to what Olaf stated, but if the group is always called '$ABCD-', then you just string match.
I have not such group, so using one I have...
# List all group whose name starts with Lab
# Get all AD users and select only those with principal group membership where group name matches LabU
You must be logged in to reply to this topic.