AntiMalware Status

List users from 3 different Active Directory Groups with PowerShell

Here is a quick sample of Power Shell snippet to list users from 3 different Active Directory groups:

1
2
3
Import-Module ActiveDirectory
$groups = "AWS-IAM-PCI-Prod-Admin","AWS-IAM-PCI-Prod-Deploy","AWS-IAM-PCI-Prod-Monitoring"
foreach($group in $groups){Get-ADGroupMember -Identity $group -Recursive | Select-Object SamAccountName}

It will list SamAccountName for all member users in those 3 Groups.

Leave a Reply