Useful Active Directory PowerShell Commands

Useful Active Directory PowerShell Commands

1. Find AD Group Members

Get-ADGroup -Identity “Group1” | Get-ADGroupMember | Select Name

2. Find AD Group Members from multiple Groups

Get-ADGroup -Filter {Name -like “Group1” -OR Name -like “Group2”} | Get-ADGroupMember | select Name

3. Write Group Name and Members

$groups = @()
$groups = ‘Domain Admins’,’Administrators’
Write-Host ‘Group_Name’,’Member’
foreach ($group in $groups)
{
$members = @()
$members = Get-ADGroupMember -Identity $group
foreach ($member in $members)
{
Write-Host $group $member.Name
}
}

 

 

About The Author

Related posts

Leave a Reply

Your email address will not be published. Required fields are marked *