How to get the list of group of members from active directory via PowerShell script

Опубликовано: 12 Май 2026
на канале: Troubleshooting Steps
156
4

Below the mentioned script to get the details of AD group of members list.

Import the Active Directory module
Import-Module ActiveDirectory

Get members of the "groupname" group
$domainAdmins = Get-ADGroupMember -Identity "groupname"

Display the count of domain administrators
Write-Host "Number of Domain Administrators: $($domainAdmins.Count)"

Export the list of domain administrators to a CSV file
$domainAdmins | Select-Object Name, SamAccountName, ObjectClass | Export-Csv -Path "C:\path\domainAdmins.csv" -NoTypeInformation -Encoding UTF8

Write-Host "The list of domain administrators has been exported to C:\domainAdmins.csv"



   • Find Windows Install Date Using Command Pr...  
   • PowerShell script to get SSL certificate d...  
   • How to get hostname from IP using ping com...  
   • How to Reset Admin Password on MacBook (ma...