Groups PS

#Enumeration Groups

get-adgroup -Filter *

#Get members of a group

Get-ADGroupMember -Identity "domain admins" -Recursive

#Get group and the member of the group

$gg = get-adgroup -Filter 'name -like "sccm"' -Properties *| Select-Object SamAccountName foreach ($g in $gg) { Write-Host $g -ForegroundColor Green Get-ADGroupMember -Identity $g.SamAccountName | Select-Object samaccountName }

#Get group membership of account

Get-ADPrincipalGroupMembership -Identity samaccountname

Last updated