\n Hi, and welcome to the PowerShell forum! \n\n\nDon’t apologize for being a “noob” or “newbie” or “n00b.” There’s just no need – nobody will think you’re stupid, and the forums are all about asking questions. Just ask! \n\n\nUse a descriptive subject. Don’t say “Need help” or “PowerShell Help”, actually summarize what the problem is. It helps the rest of us keep track of which problem is which. \n\n\nDon’t post massive scripts. We’re all volunteers and we don’t have time to read all that, nor will we copy…\n <\/blockquote>\n<\/aside>\n","upvoteCount":0,"datePublished":"2021-06-01T14:25:38.000Z","url":"https://community.spiceworks.com/t/ad-security-group-membership/801463/2","author":{"@type":"Person","name":"Neally","url":"https://community.spiceworks.com/u/Neally"}},{"@type":"Answer","text":"I ran this below and found std group memberships. I was able to save them for future need and then though I should also export the Security group membership and found I could list members for a single group, but I could not find a way to list a single user membership in al Security groups in the event I want to replicate a specific power user and questioned why this person was in various groups I felt were inappropriate. I’m looking for another user, not me. Your script on the bottom lists the user as a member of Domain users, which isn’t “Security”.<\/p>\n
Get-ADPrincipalGroupMembership fhall | select name\n<\/code><\/pre>\nPS C:\\windows\\system32> Get-ADPrincipalGroupMembership $username |\n>> Where-Object {$_.GroupCategory -eq 'Security' } |\n>> Select-Object name\nGet-ADPrincipalGroupMembership : Cannot validate argument on parameter 'Identity'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again.\nAt line:1 char:32\n+ Get-ADPrincipalGroupMembership $username |\n+ ~~~~~~~~~\n + CategoryInfo : InvalidData: (:) [Get-ADPrincipalGroupMembership], ParameterBindingValidationException\n + FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.ActiveDirectory.Management.Commands.GetADPrincipalGroupMembership\n\n<\/code><\/pre>\nRun another way<\/p>\n
PS C:\\Users\\cl> Get-ADPrincipalGroupMembership **fhall** | Where-Object {$_.GroupCat\negory -eq 'Security' } | Select-Object name\n\nname\n----\nDomain Users\n\n<\/code><\/pre>","upvoteCount":0,"datePublished":"2021-06-01T14:50:45.000Z","url":"https://community.spiceworks.com/t/ad-security-group-membership/801463/3","author":{"@type":"Person","name":"clindell","url":"https://community.spiceworks.com/u/clindell"}},{"@type":"Answer","text":"\n\n
<\/div>\n
CLINDELL:<\/div>\n
\nDomain users, which isn’t “Security”.<\/p>\n<\/blockquote>\n<\/aside>\n
Yes it is.<\/p>\n
<\/p>\n
if you want to exclude it you can add another ‘where-object’ statement.<\/p>\n
$username = 'fhall'\nGet-ADPrincipalGroupMembership $userName | \nWhere-Object {$_.GroupCategory -eq 'Security' } | \nWhere-Object {$_.Name -ne 'Domain Users' } |\nSelect-Object name\n<\/code><\/pre>","upvoteCount":0,"datePublished":"2021-06-01T15:07:58.000Z","url":"https://community.spiceworks.com/t/ad-security-group-membership/801463/4","author":{"@type":"Person","name":"Neally","url":"https://community.spiceworks.com/u/Neally"}},{"@type":"Answer","text":"what if you try<\/p>\n
get-aduser username -prop MemberOf |\nselect Name,@{N=\"MemberGroups\"; E={(($_.MemberOf).split(\",\") | where-object {$_.contains(\"CN=\")}).replace(\"CN=\",\"\")-join ','}}\n<\/code><\/pre>\nall<\/p>\n
get-aduser -f * -prop MemberOf |\nselect Name,@{N=\"MemberGroups\"; E={(($_.MemberOf).split(\",\") | where-object {$_.contains(\"CN=\")}).replace(\"CN=\",\"\")-join ','}}\n<\/code><\/pre>","upvoteCount":1,"datePublished":"2021-06-01T15:14:16.000Z","url":"https://community.spiceworks.com/t/ad-security-group-membership/801463/5","author":{"@type":"Person","name":"jitensh","url":"https://community.spiceworks.com/u/jitensh"}},{"@type":"Answer","text":"\n\n
<\/div>\n
JitenSh:<\/div>\n
\nwhat if you try<\/p>\n
get-aduser username -prop MemberOf |\nselect @{N=\"MemberGroups\"; E={(($_.MemberOf).split(\",\") | where-object {$_.contains(\"CN=\")}).replace(\"CN=\",\"\")-join ','}}\n<\/code><\/pre>\nall<\/p>\n
get-aduser -f * -prop MemberOf |\nselect @{N=\"MemberGroups\"; E={(($_.MemberOf).split(\",\") | where-object {$_.contains(\"CN=\")}).replace(\"CN=\",\"\")-join ','}}\n<\/code><\/pre>\n<\/blockquote>\n<\/aside>\nI thought that’s what OP didn’t want?<\/p>\n
\n“Security” group membership “Security” is not the same as “Member of” AD groups.<\/p>\n<\/blockquote>\n
I’m confused.<\/p>\n
OP, can you clarify a bit more what exactly you are looking for?<\/p>","upvoteCount":0,"datePublished":"2021-06-01T15:17:18.000Z","url":"https://community.spiceworks.com/t/ad-security-group-membership/801463/6","author":{"@type":"Person","name":"Neally","url":"https://community.spiceworks.com/u/Neally"}},{"@type":"Answer","text":"\n\n
<\/div>\n
Neally:<\/div>\n
\n