This is my tiny article on gathering members information from active directory groups using windows PowerShell in very easy, I have used one-liner script earlier for creating bulk ad users, This script will get all the members from group and export it to CSV, This is very handy when providing someone information. I am using 2 methods here to fetch group members information. Both scripts export members to CSV file. Marked values in the orange need to be changed as per your need.
Get-ADGroup Group1 | Get-ADGroupMember | Select-Object Name, SamAccountName, ObjectClass, distinguishedName | Export-Csv C:\Temp\Groupusers.csv
Get-ADGroup Group1 -Properties Members | Select-Object -ExpandProperty Members | Get-ADObject | Select-Object Name, ObjectClass, DistinguishedName |Export-Csv C:\Temp\Groupusers.csv
The best part is any user can fetch this information as needed, users cannot change any information but can retrieve easily but above scripts requires AD modules to be install and import using below URLs,
Installing, importing and using any module in powershell
Different ways to bypass Powershell execution policy :.ps1 cannot be loaded because running scripts is disabled
CSV file can be opened easily in excel.
Useful articles
POWERSHELL: INSTALLING AND CONFIGURING ACTIVE DIRECTORY
POWERSHELL ACTIVE DIRECTORY: ADD OR UPDATE (CHANGE) MANAGER NAME IN ORGANIZATION TAB OF USER
POWERSHELL ACTIVE DIRECTORY: ADD OR UPDATE PROXYADDRESSES IN USER PROPERTIES ATTRIBUTE EDITOR
Powershell one liner: Create multiple user accounts
Active Directory Powershell: Create bulk users from CSV file